Permalink
Browse files

[t] clean up various calls to try, system, etc

git-svn-id: http://svn.pugscode.org/pugs@22090 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 2752f2f commit 0de784b8e3491a81b5f8ae4629c6a2a67dc337e4 lwall committed Sep 1, 2008
View
@@ -2,6 +2,8 @@ use v6;
use Test;
plan 13;
+sub nok { @_ == 2 and ok @_[0], @_[1] }
+
# L<S03/Loose unary precedence>
nok(not 1, "not 1 is false");
@@ -32,6 +32,6 @@ plan 4;
{
my @a = 'a'..'e';
my $a = 0;
- $a ++ until shift(@a) eq 'c';
+ $a++ until shift(@a) eq 'c';
is($a, 2, "post until");
}
@@ -4,7 +4,7 @@ use Test;
plan 39;
-# FIXME: There is probably a better way, perhapse using try/CATCH, but I was
+# FIXME: There is probably a better way, perhaps using try/CATCH, but I was
# unable to figure out the try/CATCH syntax.
# All these tests should be re-written in terms of lives_ok();
sub nok_error( $error, $message? ) {
@@ -39,11 +39,11 @@ sub levelwrap($n) {
is( levelwrap( 1 ), 1, "Sanity test." );
is( levelwrap( 2 ), 2, "Sanity test." );
-try{ is( &levelwrap.callwith( 1 ), 1, "Check that functions have a 'callwith' that works. " )};
+try { is( &levelwrap.callwith( 1 ), 1, "Check that functions have a 'callwith' that works. " )};
nok_error( $!, "callwith does not seem to work." );
for (1..10) -> $num {
- try{
+ try {
ok(
&levelwrap.wrap({
callwith( $^t++ );
@@ -55,7 +55,7 @@ is Backend2.new.hi, 23, "basic sanity (2)";
ok ($a.backend = Backend1.new()), "setting a handler object (3)";
ok (!($a ~~ Backend1)), "object wasn't isa()ed (3)";
#?pugs todo 'feature'
- is try({ $a.hi }), 42, "method was successfully handled by backend object (3)";
+ is try { $a.hi }, 42, "method was successfully handled by backend object (3)";
}
}
@@ -72,7 +72,7 @@ is Backend2.new.hi, 23, "basic sanity (2)";
ok ($a.backend = Backend1.new()), "setting a handler object (4)";
ok (!($a ~~ Backend1)), "object wasn't isa()ed (4-1)";
ok (!($a ~~ Backend2)), "object wasn't isa()ed (4-2)";
- is (try{ $a.hi }), 42, "method was successfully handled by backend object (4)", :todo<feature>;
+ is try { $a.hi }, 42, "method was successfully handled by backend object (4)", :todo<feature>;
}
}
View
@@ -2,7 +2,7 @@ use v6;
use Test;
# L<S29/"OS"/"=item run">
-# system may be re-named to run, so link there.
+# system is renamed to run, so link there.
plan 3;
@@ -17,11 +17,11 @@ my $pugs = ($*OS eq any(<MSWin32 mingw msys cygwin>))
my $res;
-$res = system($pugs,'-e1');
-ok($res,"system() to an existing program does not die (and returns something true)");
+$res = run($pugs,'-e1');
+ok($res,"run() to an existing program does not die (and returns something true)");
-$res = system("program_that_does_not_exist_ignore_this_error_please.exe");
-ok(!$res, "system() to a nonexisting program does not die (and returns something false)");
+$res = run("program_that_does_not_exist_ignore_this_error_please.exe");
+ok(!$res, "run() to a nonexisting program does not die (and returns something false)");
-$res = system("program_that_does_not_exist_ignore_errors_please.exe","a","b");
-ok(!$res, "system() to a nonexisting program with an argument list does not die (and returns something false)");
+$res = run("program_that_does_not_exist_ignore_errors_please.exe","a","b");
+ok(!$res, "run() to a nonexisting program with an argument list does not die (and returns something false)");

0 comments on commit 0de784b

Please sign in to comment.