Permalink
Browse files

Merge branch 'master' of git://github.com/rakudo/rakudo into newinet

  • Loading branch information...
2 parents ab308ee + 592e298 commit 8f7c259866e3c7ee76f55a98234a7292fdd44345 Jarrod committed Mar 14, 2011
Showing with 29 additions and 16 deletions.
  1. +23 −13 Test.pm
  2. +3 −3 src/core/Any-list.pm
  3. +3 −0 src/core/IO.pm
View
36 Test.pm
@@ -44,8 +44,8 @@ multi sub plan($number_of_tests) is export {
}
# Emit two successive timestamps to measure the measurment overhead,
# and to eliminate cacheing bias, if it exists, from the first test.
- say '# t=' ~ pir::time__N() if %*ENV{'PERL6_TEST_TIMES'};
- say '# t=' ~ pir::time__N() if %*ENV{'PERL6_TEST_TIMES'};
+ say '# t=' ~ now.to-posix[0] if %*ENV{'PERL6_TEST_TIMES'};
+ say '# t=' ~ now.to-posix[0] if %*ENV{'PERL6_TEST_TIMES'};
}
multi sub pass($desc) is export {
@@ -141,14 +141,19 @@ multi sub isa_ok(Mu $var, Mu $type, $msg) is export {
}
multi sub dies_ok(Callable $closure, $reason) is export {
+ my $death = 0;
+ my $bad_death = 0;
try {
$closure();
+ CATCH {
+ $death = 1;
+ when / ^ 'Null PMC access ' / {
+ diag "wrong way to die: '$!'";
+ $bad_death = 1;
+ }
+ }
}
- #if "$!" ~~ / ^ 'Null PMC access ' / {
- # diag "wrong way to die: '$!'";
- #}
- proclaim(defined($!), $reason);
- #proclaim((defined $! && "$!" !~~ / ^ 'Null PMC access ' /), $reason);
+ proclaim( $death && !$bad_death, $reason );
}
multi sub dies_ok(Callable $closure) is export {
dies_ok($closure, '');
@@ -166,11 +171,16 @@ multi sub lives_ok(Callable $closure) is export {
multi sub eval_dies_ok(Str $code, $reason) is export {
my $ee = eval_exception($code);
- #if "$ee" ~~ / ^ 'Null PMC access ' / {
- # diag "wrong way to die: '$ee'";
- #}
- proclaim((defined $ee), $reason);
- # proclaim((defined $ee && "$ee" !~~ / ^ 'Null PMC access' /), $reason);
+ if defined $ee {
+ my $bad_death = "$ee" ~~ / ^ 'Null PMC access ' /;
+ if $bad_death {
+ diag "wrong way to die: '$ee'";
+ }
+ proclaim( !$bad_death, $reason );
+ }
+ else {
+ proclaim( 0, $reason );
+ }
}
multi sub eval_dies_ok(Str $code) is export {
eval_dies_ok($code, '');
@@ -226,7 +236,7 @@ sub proclaim($cond, $desc) {
print $todo_reason;
}
print "\n";
- say '# t=' ~ pir::time__N() if %*ENV{'PERL6_TEST_TIMES'};
+ say '# t=' ~ now.to-posix[0] if %*ENV{'PERL6_TEST_TIMES'};
if !$cond && $die_on_fail && !$todo_reason {
die "Test failed. Stopping test";
View
@@ -381,9 +381,9 @@ proto sub end(@array) { @array.end; }
proto sub grep(Mu $test, *@values) { @values.grep($test); }
proto sub first(Mu $test, @values) { @values.first($test); }
multi sub first(Mu $test, *@values) { @values.first($test); }
-proto sub min($by, *@values) { @values.min($by); }
-proto sub max($by, *@values) { @values.max($by); }
-proto sub minmax($by, *@values) { @values.minmax($by); }
+proto sub min(*@values, :$by) { @values.min($by); }
+proto sub max(*@values, :$by) { @values.max($by); }
+proto sub minmax(*@values, :$by) { @values.minmax($by); }
proto sub uniq(@values) { @values.uniq; }
multi sub uniq(*@values) { @values.uniq; }
proto sub pick ($num, Bool :$replace, *@values) {
View
@@ -191,6 +191,9 @@ class IO is Cool {
}
multi method copy($dest as Str) {
+ if self.d() {
+ die "Cannot copy '$.path': Is a directory"
+ }
try {
pir::new__PS('File').copy($.path, $dest);
}

0 comments on commit 8f7c259

Please sign in to comment.