Skip to content

Instantly share code, notes, and snippets.

@aereal
Created Jun 7, 2013
Embed
What would you like to do?
sub expect (&@) {
my ($effector, $comparator, $state) = @_;
my ($before, undef, $after) = map { $_->() } ($state, $effector, $state);
cmp_ok $before, $comparator, $after;
}
sub make_changes (&) {
my ($actual) = @_;
("!=", $actual);
}
sub make_no_changes (&) {
my ($actual) = @_;
("==", $actual);
}
use Test::More;
my $state = 0;
expect { $state = 1 } make_changes { $state };
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment