line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::Change; |
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
50
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
50
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
105
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/assert_change/; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
483
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub assert_change { |
12
|
4
|
|
|
4
|
0
|
5
|
my ($self, $object, $prop, $msg) = @_; |
13
|
|
|
|
|
|
|
|
14
|
4
|
50
|
|
|
|
12
|
flag($self, 'message', $msg) if defined $msg; |
15
|
4
|
|
|
|
|
10
|
my $fn = flag($self, 'object'); |
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
|
|
15
|
ref($self)->new($object, $msg)->to->have->property($prop); |
18
|
4
|
|
|
|
|
23
|
ref($self)->new($fn)->is->a('CodeRef'); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
17
|
my $initial = $object->{$prop}; |
21
|
4
|
|
|
|
|
13
|
$fn->(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $self->assert( |
24
|
4
|
|
|
|
|
30
|
$initial ne $object->{$prop}, |
25
|
|
|
|
|
|
|
'expected .' . $prop . ' to change', |
26
|
|
|
|
|
|
|
'expected .' . $prop . ' to not change' |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |