Changeset 21146 for t/spec/S12-enums/thorough.t
- Timestamp:
- 07/01/08 22:23:15 (5 months ago)
- Files:
-
- 1 moved
-
t/spec/S12-enums/thorough.t (moved) (moved from t/oo/enums.t) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S12-enums/thorough.t
r20490 r21146 3 3 use Test; 4 4 5 plan 5 8;5 plan 57; 6 6 7 = pod7 =begin description 8 8 9 9 Enum tests from L<S12/Enums> 10 10 11 = cut11 =end description 12 12 13 #?pugs 999 skip 13 14 # L<S12/Enums/values are specified as a list> 14 ok eval('enum day <Sun Mon Tue Wed Thu Fri Sat>'), "basic enum definition worked", :todo<feature>;15 enum day <Sun Mon Tue Wed Thu Fri Sat>; 15 16 17 #?DOES 12 16 18 sub test_stuff($x) { 17 ok eval('not $x does Wed'), "basic enum mixing worked ($x-2)", :todo<feature>;18 is eval('$x.day'), 3, "automatically created accessor worked ($x)", :todo<feature>;19 is eval('day::Tue'), 3, "enum provided a correct mapping ($x)", :todo<feature>;20 ok eval('$x ~~ day'), "smartmatch worked correctly ($x-1)", :todo<feature>;21 ok eval('$x ~~ Tue'), "smartmatch worked correctly ($x-2)", :todo<feature>;22 ok eval('$x ~~ day::Tue'), "smartmatch worked correctly ($x-3)", :todo<feature>;23 ok eval('not $x ~~ Wed'), "smartmatch worked correctly ($x-4)", :todo<feature>;24 ok eval('$x.does(Tue)'), ".dos worked correctly ($x-1)", :todo<feature>;25 ok eval('$x.does(day)'), ".dos worked correctly ($x-2)", :todo<feature>;26 is eval('$x.day'), 3, ".day worked correctly ($x)", :todo<feature>;27 ok eval('Tue $x'), "Tue() worked correctly ($x)", :todo<feature>;28 ok eval('$x.Tue'), ".Tue() worked correctly ($x)", :todo<feature>;19 ok not $x does Wed, "basic enum mixing worked ($x-2)"; 20 is $x.day, 3, "automatically created accessor worked ($x)"; 21 is day::Tue, 3, "enum provided a correct mapping ($x)"; 22 ok $x ~~ day, "smartmatch worked correctly ($x-1)"; 23 ok $x ~~ Tue, "smartmatch worked correctly ($x-2)"; 24 ok $x ~~ day::Tue, "smartmatch worked correctly ($x-3)"; 25 ok $x |~~ Wed, "smartmatch worked correctly ($x-4)"; 26 ok $x.does(Tue), ".does worked correctly ($x-1)"; 27 ok $x.does(day), ".does worked correctly ($x-2)"; 28 is $x.day, 3, ".day worked correctly ($x)"; 29 ok Tue $x, "Tue() worked correctly ($x)"; 30 ok $x.Tue, ".Tue() worked correctly ($x)"; 29 31 } 30 32 … … 33 35 is $x, 1, "basic sanity (1)"; 34 36 # L<S12/Enums/has the right semantics mixed in:> 35 ok eval('$x does Tue'), "basic enum mixing worked (1-1)"; 37 ok $x does Tue, "basic enum mixing worked (1-1)"; 38 $x does Tue; 36 39 test_stuff($x); 37 40 } … … 41 44 is $x, 2, "basic sanity (2)"; 42 45 # L<S12/Enums/or pseudo-hash form:> 43 ok eval('$x does day<Tue>'), "basic enum mixing worked (2-1)";46 ok $x does day<Tue>, "basic enum mixing worked (2-1)"; 44 47 test_stuff($x); 45 48 } … … 49 52 is $x, 3, "basic sanity (3)"; 50 53 # L<S12/Enums/is the same as> 51 ok eval('$x does day::Tue'), "basic enum mixing worked (3-1)";54 ok $x does day::Tue, "basic enum mixing worked (3-1)"; 52 55 test_stuff($x); 53 56 } … … 57 60 is $x, 4, "basic sanity (4)"; 58 61 # L<S12/Enums/which is short for something like:> 59 ok eval('$x does day'), "basic enum mixing worked (4-0)";60 ok eval('$x.day = &day::("Tue")'), "basic enum mixing worked (4-1)", :todo<feature>;62 ok $x does day, "basic enum mixing worked (4-0)"; 63 ok $x.day = &day::("Tue"), "basic enum mixing worked (4-1)"; 61 64 test_stuff($x); 62 65 }
