Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec]: Eliminate some "Redeclared variable" warnings in tests

git-svn-id: http://svn.pugscode.org/pugs@24679 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 1e0f57042650930a5db5da99e514735582d4ae56 1 parent 5f1aab2
pmichaud authored
View
4 S02-builtin_data_types/range.t
@@ -23,11 +23,11 @@ is @r, [1, 2, 3, 4, 5], 'got the right array';
# Range of Str
-my $r = 'a'..'c';
+$r = 'a'..'c';
isa_ok $r, Range;
# XXX unspecced: exact value of Range.perl
is $r.perl, '"a".."c"', 'canonical representation';
-my @r = $r;
+@r = $r;
is @r, [< a b c >], 'got the right array';
# Stationary ranges
View
3  S03-operators/hyper.t
@@ -164,9 +164,8 @@ my @e;
my @e = (1, 2, 3);
is(~@r, ~@e, "method call on integer list elements");
- my @r;
eval '@r = (1, 4, 9)>>.sqrt';
- my @e = (1, 2, 3);
+ @e = (1, 2, 3);
is(~@r, ~@e, "method call on integer list elements (ASCII)");
};
View
1  S04-declarations/my.t
@@ -49,6 +49,7 @@ eval_dies_ok 'foo(42)', 'my &foo is lexically scoped';
eval_lives_ok 'my $x = my $y = 0;', '"my $x = my $y = 0" parses';
+#?rakudo skip "Redeclaration of variable"
{
my $test = "value should still be set for arg, even if there's a later my";
sub foo2 (*%p) {
View
2  S04-statement-modifiers/given.t
@@ -22,7 +22,7 @@ plan 5;
{
my $a = '';
- my $a = $_ given 'a';
+ $a = $_ given 'a';
is($a, 'a', "post given");
}
View
4 S05-transliteration/with-closure.t
@@ -23,8 +23,8 @@ is $s, 'aXbYcYdX', 'Source string unchanged';
is $s.trans([<X Y>] => [{++$x},{++$y}]), 'a3b3c4d4', 'can use closures in pairs of arrays';
is $s, 'aXbYcYdX', 'Source string unchanged';
-my $x = 0;
-my $y = 0;
+$x = 0;
+$y = 0;
my $s2 = 'ABC111DEF111GHI';
View
6 S29-array/pop.t
@@ -19,15 +19,15 @@ plan 27;
is($a, 4, 'pop(@pop) works');
is(+@pop, 3, 'we have 3 elements in the array');
- my $a = pop @pop;
+ $a = pop @pop;
is($a, 3, 'pop @pop works');
is(+@pop, 2, 'we have 2 elements in the array');
- my $a = @pop.pop();
+ $a = @pop.pop();
is($a, 2, '@pop.pop() works');
is(+@pop, 1, 'we have 1 element in the array');
- my $a = @pop.pop;
+ $a = @pop.pop;
is($a, 1, '@pop.pop works');
is(+@pop, 0, 'we have no more element in the array');
View
2  S29-list/join.t
@@ -65,7 +65,7 @@ is($joined4c, "a b c", 'join ":", [] should not join anything');
is(["a", "b", "c"].join(''), "abc", '[].join("") works');
-my @list = ("a", "b", "c");
+@list = ("a", "b", "c");
is(@list.join(''), "abc", '@list.join("") works');
View
35 S29-scalar/defined.t
@@ -42,29 +42,30 @@ ok(!defined($foo), 'undefine $foo works');
# try the invocant syntax
-my $foo;
-#?rakudo skip 'my $foo; $foo.defined'
-ok(!$foo.defined, 'unassigned variable $foo is undefined');
-
-$foo = 1;
-ok($foo.defined, 'variable $foo is now defined (as numeric literal 1)');
+{
+ my $foo;
+ #?rakudo skip 'my $foo; $foo.defined'
+ ok(!$foo.defined, 'unassigned variable $foo is undefined');
-$foo = "";
-ok($foo.defined, 'variable $foo is now defined (as a empty string)');
+ $foo = 1;
+ ok($foo.defined, 'variable $foo is now defined (as numeric literal 1)');
-$foo = undef;
-ok(!$foo.defined, 'variable $foo is now undefined again');
+ $foo = "";
+ ok($foo.defined, 'variable $foo is now defined (as a empty string)');
-$foo = "a";
-ok($foo.defined, 'variable $foo is now defined (as string "a")');
+ $foo = undef;
+ ok(!$foo.defined, 'variable $foo is now undefined again');
-$foo = 0;
-ok($foo.defined, 'variable $foo is now defined (as numeric literal 0)');
+ $foo = "a";
+ ok($foo.defined, 'variable $foo is now defined (as string "a")');
-undefine($foo);
-#?rakudo skip 'undefine $foo; $foo.defined'
-ok(!$foo.defined, 'undef $foo works');
+ $foo = 0;
+ ok($foo.defined, 'variable $foo is now defined (as numeric literal 0)');
+ undefine($foo);
+ #?rakudo skip 'undefine $foo; $foo.defined'
+ ok(!$foo.defined, 'undef $foo works');
+}
# While porting a Perl 5 solution to QoTW regular #24, I noticed the following bug:
# my %a = (a => 1);
Please sign in to comment.
Something went wrong with that request. Please try again.