File: bool.t

package info (click to toggle)
libsub-handlesvia-perl 0.050002-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,656 kB
  • sloc: perl: 9,585; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download | duplicates (3)
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;