Skip to content
Browse files

[t/spec] remove eval from last.t; vim modelines

git-svn-id: http://svn.pugscode.org/pugs@27904 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ff95b7c commit 9ba803682fb41323063c691511df1f061b8b9071 moritz committed Aug 8, 2009
Showing with 36 additions and 23 deletions.
  1. +2 −0 S03-operators/nesting.t
  2. +32 −23 S04-statements/last.t
  3. +2 −0 S11-modules/module-file.t
View
2 S03-operators/nesting.t
@@ -8,3 +8,5 @@ plan 2;
#?rakudo 2 skip 'RT #68008'
ok &infix:<+> === &[+], 'long and short form are the same';
is sort( &[<=>], <5 3 2 1 4> ), <1 2 3 4 5>, 'sort works using &[<=>]';
+
+# vim: ft=perl6
View
55 S04-statements/last.t
@@ -20,27 +20,30 @@ plan 8;
# test for loops with last
{
- is(
- eval('sub mylast { last; }; my $tracker = 0; for 1 .. 5 { $tracker = $_; mylast(); }; $tracker'),
- 1,
- "tracker is 1 because mylast exits loop";
- );
+ my $tracker = 0;
+ for 1 .. 5 {
+ $tracker = $_;
+ last;
+ }
+ is($tracker, 1, '... our loop only got to 1 (last)');
}
{
+ sub mylast { last; };
my $tracker = 0;
for 1 .. 5 {
$tracker = $_;
- last;
- }
- is($tracker, 1, '... our loop only got to 1 (last)');
+ mylast();
+ };
+ is $tracker, 1, 'can last() outside a subroutine and a for-loop';
}
+
{
my $tracker = 0;
for 1 .. 5 {
$tracker = $_;
- last if $_ == 3;
+ last if $_ == 3;
}
is($tracker, 3, '... our loop only got to 3 (last if <cond>)');
}
@@ -49,7 +52,7 @@ plan 8;
my $tracker = 0;
for 1 .. 5 {
$tracker = $_;
- $_ == 3 && last;
+ $_ == 3 && last;
}
is($tracker, 3, '... our loop only got to 3 (<cond> && last)');
}
@@ -58,18 +61,20 @@ plan 8;
my $tracker = 0;
for 1 .. 5 {
$tracker = $_;
- $_ == 3 and last;
+ $_ == 3 and last;
}
is($tracker, 3, '... our loop only got to 3 (<cond> and last)');
}
+#?pugs skip 'last LABEL'
+#?rakudo skip 'last LABEL'
{
- #?pugs todo 'bug'
- is(
- eval('my $var=0; DONE: for (1..2) { last DONE; $var++;}; $var'),
- 0,
- "var is 0 because last before increment"
- );
+ my $var = 0;
+ DONE: for (1..2) {
+ last DONE;
+ $var++;
+ };
+ is($var, 0, "var is 0 because last before increment")
}
{
@@ -83,13 +88,17 @@ plan 8;
is($tracker, 15, 'our inner loop only runs once per (last inside nested loops)');
}
+#?pugs skip 'last LABEL'
+#?rakudo skip 'last LABEL'
{
- is(
- eval('my $var=0; OUT: for (1..2) { IN: for (1..2) { last OUT }; $var++;}; $var'),
- 0,
- "var is 0 because last before increment in nested loop",
- :todo(1)
- );
+ my $var = 0;
+ OUT: for (1..2) {
+ IN: for (1..2) {
+ last OUT;
+ }
+ $var++;
+ };
+ is($var, 0, "var is 0 because last before increment in nested loop");
}
# vim: ft=perl6
View
2 S11-modules/module-file.t
@@ -9,3 +9,5 @@ plan 3;
is($?PACKAGE, 'Foo::Bar', '$?PACKAGE for "module Foo::Bar;"');
is($?CLASS, 'Main', '$?CLASS for "module Foo::Bar;"');
is($?MODULE, 'Foo::Bar', '$?MODULE for "module Foo::Bar;"');
+
+# vim: ft=perl6

0 comments on commit 9ba8036

Please sign in to comment.
Something went wrong with that request. Please try again.