Show
Ignore:
Timestamp:
07/01/08 22:23:15 (5 months ago)
Author:
moritz
Message:

[spec] moved oo/enum.t to spec/

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • t/spec/S12-enums/thorough.t

    r20490 r21146  
    33use Test; 
    44 
    5 plan 58; 
     5plan 57; 
    66 
    7 =pod 
     7=begin description 
    88 
    99Enum tests from L<S12/Enums> 
    1010 
    11 =cut 
     11=end description 
    1212 
     13#?pugs 999 skip 
    1314# 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>; 
     15enum day <Sun Mon Tue Wed Thu Fri Sat>; 
    1516 
     17#?DOES 12 
    1618sub 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)"; 
    2931} 
    3032 
     
    3335  is $x, 1, "basic sanity (1)"; 
    3436  # 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; 
    3639  test_stuff($x); 
    3740} 
     
    4144  is $x, 2, "basic sanity (2)"; 
    4245  # 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)"; 
    4447  test_stuff($x); 
    4548} 
     
    4952  is $x, 3, "basic sanity (3)"; 
    5053  # 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)"; 
    5255  test_stuff($x); 
    5356} 
     
    5760  is $x, 4, "basic sanity (4)"; 
    5861  # 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)"; 
    6164  test_stuff($x); 
    6265}