Changeset 21228

Show
Ignore:
Timestamp:
07/04/08 20:46:33 (3 months ago)
Author:
pmichaud
Message:

S29-num/int.t: Fix syntax error, update test, remove a #?rakudo skip

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S29-num/int.t

    r21056 r21228  
    5454is(int('3e4d5'), 3e4, "int('3e4d5') is 3e4"); 
    5555 
    56 #?rakudo skip 'lexical scoping bug - RT#56274' 
    57 #?DOES 24 
    5856{ 
    59     sub __int( Str $s ) { 
    60         if ($s ~~ rx:Perl5/^(-?\d+)$/) { return $0 }; 
    61         if ($s ~~ rx:Perl5/^(-?\d+)\./) { return $0 }; 
    62         if ($s ~~ rx:Perl5/^\./) { return 0 }; 
    63         return undef; 
     57    sub __int( $s ) { 
     58        my $pos = $s.index('.'); 
     59        if ($pos > 0) { return substr($s, 0, $pos); } 
     60        return $s; 
    6461    }; 
    6562 
    6663    # Check the defaulting to $_  
    6764 
    68     for(0, 0.0, 1, 50, 60.0, 99.99, 0.4, 0.6, 
    69         -1, -50, -60.0, -99.99 
    70         ) { 
     65    for(0, 0.0, 1, 50, 60.0, 99.99, 0.4, 0.6, -1, -50, -60.0, -99.99) { 
    7166        my $int = __int($_); 
    7267        is(.int, $int, "integral value for $_ is $int");