Regenerate test files
[gitmo/Mouse.git] / t / 070_native_traits / 208_trait_bool.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10
11 {
12     package Room;
13     use Mouse;
14
15     has 'is_lit' => (
16         traits  => ['Bool'],
17         is      => 'rw',
18         isa     => 'Bool',
19         default => 0,
20         handles => {
21             illuminate  => 'set',
22             darken      => 'unset',
23             flip_switch => 'toggle',
24             is_dark     => 'not',
25         },
26         )
27 }
28
29 my $room = Room->new;
30 $room->illuminate;
31 ok( $room->is_lit, 'set is_lit to 1 using ->illuminate' );
32 ok( !$room->is_dark, 'check if is_dark does the right thing' );
33
34 $room->darken;
35 ok( !$room->is_lit, 'set is_lit to 0 using ->darken' );
36 ok( $room->is_dark, 'check if is_dark does the right thing' );
37
38 $room->flip_switch;
39 ok( $room->is_lit, 'toggle is_lit back to 1 using ->flip_switch' );
40 ok( !$room->is_dark, 'check if is_dark does the right thing' );
41
42 $room->flip_switch;
43 ok( !$room->is_lit, 'toggle is_lit back to 0 again using ->flip_switch' );
44 ok( $room->is_dark, 'check if is_dark does the right thing' );
45
46 done_testing;