Changeset 3371

Show
Ignore:
Timestamp:
05/18/05 02:43:02 (4 years ago)
Author:
mugwump
svk:copy_cache_prev:
4945
Message:

More operator overloading tests (sorry for the flurry of commits)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/subroutines/operator_overloading.t

    r3370 r3371  
    44use Test; 
    55 
    6 plan 11; 
     6plan 15; 
    77 
    88=pod 
     
    5353         :todo<feature>); 
    5454 
     55# don't know if these syntaxes are legal... 
    5556eval_ok('sub infix:"<"($one, $two) { return (rand(1) <=> 0.5) }', 
    56         "quoted infix subs", :todo<bug>); 
     57        "quoted infix sub", :todo<bug>); 
     58eval_ok('sub infix:«<»($one, $two) { return (rand(1) <=> 0.5) }', 
     59        "frenchquoted infix sub", :todo<bug>); 
    5760 
    5861sub postfix:<W> ($wobble) { return "ANDANDAND$wobble"; }; 
     
    6063is("boop" W, "ANDANDANDboop",  
    6164   'postfix operator overloading for new operator'); 
     65 
     66sub postfix:<&&&&&> ($wobble) { return "ANDANDANDANDAND$wobble"; }; 
     67is("boop"&&&&&, "ANDANDANDANDANDboop", 
     68   "postfix operator overloading for new operator (weird)"); 
    6269 
    6370my $var = 0; 
     
    6976is(Σ [1..10], 55, "sum prefix operator"); 
    7077 
     78# check that the correct overloaded method is called 
    7179sub postfix:<!> ($x) { [*] 1..$x } 
     80sub postfix:<!> (Str $x) { return($x.uc ~ "!!!") } 
     81 
    7282is(10!, 3628800, "factorial postfix operator"); 
     83is("boobies"!, "BOOBIES!!!", "correct overloaded method called"); 
    7384 
    7485