Changeset 3726

Show
Ignore:
Timestamp:
05/23/05 13:42:15 (4 years ago)
Author:
iblech
svk:copy_cache_prev:
5313
Message:

Minor test fix (delegation.t) and minor cosmetical cleanups (ChangeLog?, Main, Pugs.Help).

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r3709 r3726  
    2323* `s:globally//` is now `s:global//`. 
    2424* `&code.name` and `&code.arity` added. 
    25 * Much better error messages, with cascading stack trace 
     25* Much better error messages, with cascading stack trace. 
    2626* Several Object changes: 
    2727** MMD handling is now more sophisticated, and `$.chained.attr.methods` works. 
     
    5555 
    5656* Many new test and several tests refactored, we now have 5600+ tests. 
    57 * Perl6::Rules test suite incorporate into `t/rules/`. 
     57* Perl6::Rules test suite incorporated into `t/rules/`. 
    5858* Hangman IRC bot created from `hangman.p6`. 
    5959* OO Wizard RPG game added in `examples/games/`. 
  • src/Main.hs

    r3724 r3726  
    290290        ["This is " ++ version ++ " built for " ++ getConfig "archname" 
    291291        ,"" 
    292         ,"Summary of pugs configuration:" 
    293         ,"" ] 
     292        ,"Summary of pugs configuration:" ] 
    294293        ++ map (\x -> createConfigLine x) (map (fst) (Map.toList config)) 
    295294        ++ [ "" ] 
  • src/Pugs/Help.hs

    r3701 r3726  
    4949        putStrLn "-V:item          short configuration information for item" 
    5050        putStrLn "-v or --version  version" 
    51         putStrLn "-l -d and -w are ignored for compatability with perl 5" 
     51        putStrLn "-l -d and -w are ignored for compatability with Perl 5" 
    5252 
    5353name :: String 
     
    102102intro = putStrLn $ unlines 
    103103    [ "Welcome to Pugs -- " ++ name 
    104     , "Type :h for help" 
     104    , "Type :h for help." 
    105105    ] 
  • t/oo/delegation.t

    r3710 r3726  
    1414# L<S12/"Delegation"> 
    1515 
    16 eval_ok ' 
     16ok eval(' 
    1717  class Backend1 { method hi() { 42 } method cool() { 1337 } } 
    1818  class Backend2 { method hi() { 23 } method cool() {  539 } } 
    1919  class Frontend { has $.backend is rw handles "hi" } 
    20 ', "class definition worked", :todo<feature>; 
     20  1 
     21'), "class definition worked", :todo<feature>; 
    2122 
    22 eval_is 'Backend1.new.hi', 42, "basic sanity (1)", :todo<feature>; 
    23 eval_is 'Backend2.new.hi', 23, "basic sanity (2)", :todo<feature>; 
     23is eval('Backend1.new.hi'), 42, "basic sanity (1)", :todo<feature>; 
     24is eval('Backend2.new.hi'), 23, "basic sanity (2)", :todo<feature>; 
    2425 
    2526{ 
    2627  my $a; 
    27   eval_ok '$a = Frontend.new', "basic instantiation worked (1)", :todo<feature>; 
    28   eval_ok '!try { $a.hi }', "calling a method on no object didn't succeed (1)"; 
    29   eval_ok '$a.backend = Backend1.new()', "setting a handler object (1)", :todo<feature>; 
    30   eval_ok '!$a ~~ Backend1',             "object wasn't isa()ed (1)", :todo<feature>; 
    31   eval_is '$a.hi', 42, "method was successfully handled by backend object (1)", :todo<feature>; 
     28  ok eval('$a = Frontend.new'), "basic instantiation worked (1)", :todo<feature>; 
     29  ok eval('!try { $a.hi }'), "calling a method on no object didn't succeed (1)"; 
     30  ok eval('$a.backend = Backend1.new()'), "setting a handler object (1)", :todo<feature>; 
     31  ok eval('!$a ~~ Backend1'),             "object wasn't isa()ed (1)", :todo<feature>; 
     32  is eval('$a.hi'), 42, "method was successfully handled by backend object (1)", :todo<feature>; 
    3233} 
    3334 
    3435{ 
    3536  my $a; 
    36   eval_ok '$a = Frontend.new', "basic instantiation worked (2)", :todo<feature>; 
    37   eval_ok '!try { $a.hi }', "calling a method on no object didn't succeed (2)"; 
    38   eval_ok '$a.backend = Backend2.new()', "setting a handler object (2)", :todo<feature>; 
    39   eval_ok '!$a ~~ Backend2',             "object wasn't isa()ed (2)", :todo<feature>; 
    40   eval_is '$a.hi', 23, "method was successfully handled by backend object (2)", :todo<feature>; 
     37  ok eval('$a = Frontend.new'), "basic instantiation worked (2)", :todo<feature>; 
     38  ok eval('!try { $a.hi }'), "calling a method on no object didn't succeed (2)"; 
     39  ok eval('$a.backend = Backend2.new()'), "setting a handler object (2)", :todo<feature>; 
     40  ok eval('!$a ~~ Backend2'),             "object wasn't isa()ed (2)", :todo<feature>; 
     41  is eval('$a.hi'), 23, "method was successfully handled by backend object (2)", :todo<feature>; 
    4142} 
    4243 
    4344 
    4445# L<S12/"Delegation" /Any other kind of argument to handles is considered to be a smartmatch selector for methods/> 
    45 eval_ok 'class ReFrontend { has $.backend is rw handles /^hi/ }', 
     46ok eval('class ReFrontend { has $.backend is rw handles /^hi/ }; 1'), 
    4647  "class definition using a smartmatch handle worked", :todo<feature>; 
    4748{ 
    4849  my $a; 
    49   eval_ok '$a = ReFrontend.new', "basic instantiation worked (3)", :todo<feature>; 
    50   eval_ok '!try { $a.hi }', "calling a method on no object didn't succeed (3)"; 
    51   eval_ok '$a.backend = Backend1.new()', "setting a handler object (3)", :todo<feature>; 
    52   eval_ok '!$a ~~ Backend1',             "object wasn't isa()ed (3)", :todo<feature>; 
    53   eval_is '$a.hi', 42, "method was successfully handled by backend object (3)", :todo<feature>; 
     50  ok eval('$a = ReFrontend.new'), "basic instantiation worked (3)", :todo<feature>; 
     51  ok eval('!try { $a.hi }'), "calling a method on no object didn't succeed (3)"; 
     52  ok eval('$a.backend = Backend1.new()'), "setting a handler object (3)", :todo<feature>; 
     53  ok eval('!$a ~~ Backend1'),             "object wasn't isa()ed (3)", :todo<feature>; 
     54  is eval('$a.hi'), 42, "method was successfully handled by backend object (3)", :todo<feature>; 
    5455} 
    5556 
    5657 
    5758# L<S12/"Delegation" /If you say/> 
    58 eval_ok 'class ClassFrontend { has $.backend is rw handles Backend2 }', 
     59ok eval('class ClassFrontend { has $.backend is rw handles Backend2 }; 1'), 
    5960  "class definition using a Class handle worked", :todo<feature>; 
    6061{ 
    6162  my $a; 
    62   eval_ok '$a = ClassFrontend.new', "basic instantiation worked (4)", :todo<feature>; 
    63   eval_ok '!try { $a.hi }', "calling a method on no object didn't succeed (4)"; 
    64   eval_ok '$a.backend = Backend1.new()', "setting a handler object (4)", :todo<feature>; 
    65   eval_ok '!$a ~~ Backend1',             "object wasn't isa()ed (4-1)", :todo<feature>; 
    66   eval_ok '!$a ~~ Backend2',             "object wasn't isa()ed (4-2)", :todo<feature>; 
    67   eval_is '$a.hi', 42, "method was successfully handled by backend object (4)", :todo<feature>; 
     63  ok eval('$a = ClassFrontend.new'), "basic instantiation worked (4)", :todo<feature>; 
     64  ok eval('!try { $a.hi }'), "calling a method on no object didn't succeed (4)"; 
     65  ok eval('$a.backend = Backend1.new()'), "setting a handler object (4)", :todo<feature>; 
     66  ok eval('!$a ~~ Backend1'),             "object wasn't isa()ed (4-1)", :todo<feature>; 
     67  ok eval('!$a ~~ Backend2'),             "object wasn't isa()ed (4-2)", :todo<feature>; 
     68  is eval('$a.hi'), 42, "method was successfully handled by backend object (4)", :todo<feature>; 
    6869} 
    6970 
    7071 
    7172# L<S12/"Delegation" /You can specify multiple method names:/> 
    72 eval_ok 'class MultiFrontend { has $.backend is rw handles <hi cool> }', 
     73ok eval('class MultiFrontend { has $.backend is rw handles <hi cool> }; 1'), 
    7374  "class definition using multiple method names worked", :todo<feature>; 
    7475{ 
    7576  my $a; 
    76   eval_ok '$a = MultiFrontend.new', "basic instantiation worked (5)", :todo<feature>; 
    77   eval_ok '!try { $a.hi   }', "calling a method on no object didn't succeed (5-1)"; 
    78   eval_ok '!try { $a.cool }', "calling a method on no object didn't succeed (5-2)"; 
    79   eval_ok '$a.backend = Backend1.new()', "setting a handler object (5)", :todo<feature>; 
    80   eval_ok '!$a ~~ Backend1',             "object wasn't isa()ed (5)", :todo<feature>; 
    81   eval_is '$a.hi',     42, "method was successfully handled by backend object (5-1)", :todo<feature>; 
    82   eval_is '$a.cool', 1337, "method was successfully handled by backend object (5-2)", :todo<feature>; 
     77  ok eval('$a = MultiFrontend.new'), "basic instantiation worked (5)", :todo<feature>; 
     78  ok eval('!try { $a.hi   }'), "calling a method on no object didn't succeed (5-1)"; 
     79  ok eval('!try { $a.cool }'), "calling a method on no object didn't succeed (5-2)"; 
     80  ok eval('$a.backend = Backend1.new()'), "setting a handler object (5)", :todo<feature>; 
     81  ok eval('!$a ~~ Backend1'),             "object wasn't isa()ed (5)", :todo<feature>; 
     82  is eval('$a.hi'),     42, "method was successfully handled by backend object (5-1)", :todo<feature>; 
     83  is eval('$a.cool'), 1337, "method was successfully handled by backend object (5-2)", :todo<feature>; 
    8384}