Created
June 7, 2013 08:54
-
-
Save aereal/5727967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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