1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
use strict;
use warnings;
## skip Test::Tabs
use Test::More;
use Test::Requires '5.008001';
use Test::Fatal;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MyTest::TestClass::Bool;
my $CLASS = q[MyTest::TestClass::Bool];
## not
can_ok( $CLASS, 'my_not' );
subtest 'Testing my_not' => sub {
my $e = exception {
my $object = $CLASS->new( attr => 1 );
ok( !($object->my_not()), q{$object->my_not() is false} );
};
is( $e, undef, 'no exception thrown running not example' );
};
## reset
can_ok( $CLASS, 'my_reset' );
## set
can_ok( $CLASS, 'my_set' );
subtest 'Testing my_set' => sub {
my $e = exception {
my $object = $CLASS->new();
$object->my_set();
ok( $object->attr, q{$object->attr is true} );
};
is( $e, undef, 'no exception thrown running set example' );
};
## toggle
can_ok( $CLASS, 'my_toggle' );
subtest 'Testing my_toggle' => sub {
my $e = exception {
my $object = $CLASS->new();
$object->my_toggle();
ok( $object->attr, q{$object->attr is true} );
$object->my_toggle();
ok( !($object->attr), q{$object->attr is false} );
};
is( $e, undef, 'no exception thrown running toggle example' );
};
## unset
can_ok( $CLASS, 'my_unset' );
subtest 'Testing my_unset' => sub {
my $e = exception {
my $object = $CLASS->new();
$object->my_unset();
ok( !($object->attr), q{$object->attr is false} );
};
is( $e, undef, 'no exception thrown running unset example' );
};
done_testing;
|