Changeset 21228 for t/spec/S29-num/int.t
- Timestamp:
- 07/04/08 20:46:33 (5 months ago)
- Files:
-
- 1 modified
-
t/spec/S29-num/int.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S29-num/int.t
r21056 r21228 54 54 is(int('3e4d5'), 3e4, "int('3e4d5') is 3e4"); 55 55 56 #?rakudo skip 'lexical scoping bug - RT#56274'57 #?DOES 2458 56 { 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; 64 61 }; 65 62 66 63 # Check the defaulting to $_ 67 64 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) { 71 66 my $int = __int($_); 72 67 is(.int, $int, "integral value for $_ is $int");
