Skip to content

Instantly share code, notes, and snippets.

@aereal
Created June 7, 2013 08:54
Show Gist options
  • Save aereal/5727967 to your computer and use it in GitHub Desktop.
Save aereal/5727967 to your computer and use it in GitHub Desktop.
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