| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Pugs
Revision: 22158
Author: s1n
Date: 04 Sep 2008 22:47:59
Changes:[spec] updated bool to support the latest tests and Bool class.
Files:| ... | ...@@ -8,40 +8,40 @@ | |
| 8 | 8 | plan 18; |
| 9 | 9 | |
| 10 | 10 | # tests True and False are Bool's |
| 11 | isa_ok( True, 'Bool' ); | |
| 12 | isa_ok( False, 'Bool' ); | |
| 11 | isa_ok(Bool::True, Bool); | |
| 12 | isa_ok(Bool::False, Bool); | |
| 13 | 13 | |
| 14 | 14 | # tests they keep their Bool'ness when stored |
| 15 | my $a = True; | |
| 16 | isa_ok( $a, 'Bool' ); | |
| 15 | my $a = Bool::True; | |
| 16 | isa_ok($a, Bool); | |
| 17 | 17 | |
| 18 | my $a = False; | |
| 19 | isa_ok( $a, 'Bool' ); | |
| 18 | my $a = Bool::False; | |
| 19 | isa_ok($a, Bool); | |
| 20 | 20 | |
| 21 | 21 | # tests they work with && and || |
| 22 | True && pass( 'True works' ); | |
| 23 | False || pass( 'False works' ); | |
| 22 | Bool::True && pass('True works'); | |
| 23 | Bool::False || pass('False works'); | |
| 24 | 24 | |
| 25 | 25 | # tests they work with ! |
| 26 | !True || pass( '!True works' ); | |
| 27 | !False && pass( '!False works' ); | |
| 26 | !Bool::True || pass('!True works'); | |
| 27 | !Bool::False && pass('!False works'); | |
| 28 | 28 | |
| 29 | 29 | # tests True with ok() |
| 30 | ok( True, 'True works' ); | |
| 30 | ok(Bool::True, 'True works'); | |
| 31 | 31 | |
| 32 | 32 | # tests False with ok() and ! |
| 33 | ok( !False, 'False works' ); | |
| 33 | ok(!Bool::False, 'False works'); | |
| 34 | 34 | |
| 35 | 35 | # tests Bool stringification - interaction with ~ |
| 36 | isa_ok( ~True, 'Str' ); | |
| 37 | isa_ok( ~False, 'Str' ); | |
| 38 | ok( ~True, 'stringified True works' ); | |
| 39 | ok( !(~False), 'stringified False works' ); | |
| 36 | isa_ok(~Bool::True, Str); | |
| 37 | isa_ok(~Bool::False, Str); | |
| 38 | ok(~Bool::True, 'stringified True works'); | |
| 39 | ok(!(~Bool::False), 'stringified False works'); | |
| 40 | 40 | # NOTE. We don't try to freeze ~True into '1' |
| 41 | 41 | # and ~False into '' as pugs does now. Maybe we should (?!) |
| 42 | 42 | |
| 43 | 43 | # numification - interaction with + |
| 44 | isa_ok( +True, 'Num' ); | |
| 45 | isa_ok( +False, 'Num' ); | |
| 46 | is( +True, '1', 'True numifies to 1' ); | |
| 47 | is( +False, '0', 'False numifies to 0' ); | |
| 44 | isa_ok(+Bool::True, Num); | |
| 45 | isa_ok(+Bool::False, Num); | |
| 46 | is(+Bool::True, '1', 'True numifies to 1'); | |
| 47 | is(+Bool::False, '0', 'False numifies to 0'); |