Permalink
Browse files

[t/spec] mark various tests that intentionally declare things that ar…

…e not used

git-svn-id: http://svn.pugscode.org/pugs@31692 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ba5d987 commit 8dc7d4b8aad5199358209b4dfb4fe1d4b0bdaa91 lwall committed Jul 15, 2010
Showing with 263 additions and 264 deletions.
  1. +1 −1 S01-perl-5-integration/method.t
  2. +1 −1 S02-builtin_data_types/autovivification.t
  3. +1 −1 S02-builtin_data_types/hash.t
  4. +1 −1 S02-literals/sub-calls.t
  5. +1 −1 S02-magicals/dollar_bang.t
  6. +2 −2 S02-names_and_variables/signature.t
  7. +1 −1 S02-whitespace_and_comments/unspace.t
  8. +2 −2 S03-junctions/autothreading.t
  9. +1 −1 S03-junctions/misc.t
  10. +1 −1 S03-operators/binding-scalars.t
  11. +1 −1 S04-declarations/my.t
  12. +2 −2 S04-declarations/state.t
  13. +1 −1 S04-exceptions/fail.t
  14. +1 −1 S04-statements/if.t
  15. +1 −1 S04-statements/lift.t
  16. +1 −1 S05-grammar/action-stubs.t
  17. +1 −1 S05-grammar/signatures.t
  18. +2 −2 S06-advanced_subroutine_features/callsame.t
  19. +2 −2 S06-currying/assuming-and-mmd.t
  20. +1 −1 S06-multi/lexical-multis.t
  21. +6 −6 S06-multi/proto.t
  22. +15 −15 S06-multi/syntax.t
  23. +23 −23 S06-multi/type-based.t
  24. +4 −4 S06-multi/unpackability.t
  25. +2 −2 S06-multi/value-based.t
  26. +1 −1 S06-other/introspection.t
  27. +2 −2 S06-other/misc.t
  28. +2 −2 S06-routine-modifiers/lvalue-subroutines.t
  29. +20 −20 S06-signature/arity.t
  30. +14 −14 S06-signature/closure-parameters.t
  31. +1 −1 S06-signature/code.t
  32. +3 −3 S06-signature/errors.t
  33. +9 −9 S06-signature/introspection.t
  34. +2 −2 S06-signature/multiple-signatures.t
  35. +3 −3 S06-signature/named-parameters.t
  36. +2 −2 S06-signature/passing-arrays.t
  37. +23 −24 S06-signature/slurpy-params.t
  38. +3 −3 S06-signature/type-capture.t
  39. +1 −1 S11-modules/importing.t
  40. +1 −1 S12-attributes/class.t
  41. +1 −1 S12-attributes/instance.t
  42. +6 −6 S12-class/interface-consistency.t
  43. +6 −6 S12-introspection/methods.t
  44. +5 −5 S12-methods/calling_sets.t
  45. +1 −1 S12-methods/class-and-instance.t
  46. +1 −1 S12-methods/default-trait.t
  47. +4 −4 S12-methods/defer-call.t
  48. +5 −5 S12-methods/defer-next.t
  49. +4 −4 S12-methods/indirect_notation.t
  50. +1 −1 S12-methods/instance.t
  51. +5 −5 S12-methods/lastcall.t
  52. +2 −2 S12-methods/method-vs-sub.t
  53. +13 −13 S12-methods/multi.t
  54. +1 −1 S12-methods/trusts.t
  55. +5 −5 S12-subset/multi-dispatch.t
  56. +3 −3 S12-subset/subtypes.t
  57. +2 −2 S12-traits/basic.t
  58. +1 −1 S12-traits/parameterized.t
  59. +2 −2 S13-overloading/multiple-signatures.t
  60. +4 −4 S13-overloading/typecasting-long.t
  61. +3 −3 S13-overloading/typecasting-mixed.t
  62. +3 −3 S13-overloading/typecasting-short.t
  63. +3 −3 S14-roles/parameter-subtyping.t
  64. +1 −1 S14-roles/parameterized-mixin.t
  65. +1 −1 S14-roles/parameterized-type.t
  66. +1 −1 S14-roles/submethods.t
  67. +1 −1 S16-filehandles/chmod.t
  68. +1 −1 S29-context/eval.t
  69. +2 −2 S32-hash/exists.t
  70. +1 −1 S32-scalar/undef.t
  71. +2 −2 S32-str/sprintf.t
  72. +1 −1 integration/99problems-41-to-50.t
  73. +3 −3 integration/99problems-51-to-60.t
  74. +1 −1 integration/advent2009-day08.t
  75. +1 −1 integration/advent2009-day09.t
  76. +1 −1 integration/advent2009-day20.t
  77. +2 −2 integration/code-blocks-as-sub-args.t
  78. +1 −1 packages/Foo.pm
@@ -112,7 +112,7 @@ my $obj;
{
class Foo6 {
- method me ($class: $arg) { 'Foo6'~$arg };
+ method me ($class: $arg) { 'Foo6'~$arg }; #OK not used
};
my $obj6 = Foo6.new;
$obj = eval("FooBar->new", :lang<perl5>);
@@ -56,7 +56,7 @@ plan 7;
}
-sub foo ($baz is rw) {
+sub foo ($baz is rw) { #OK not used
# just some random subroutine.
}
@@ -210,7 +210,7 @@ lives_ok { Hash.new("a" => "b") }, 'Hash.new($pair) lives';
# RT #71064
{
class RT71064 {
- method postcircumfix:<{ }>($x) { 'bughunt' }
+ method postcircumfix:<{ }>($x) { 'bughunt' } #OK not used
method rt71064() {
my %h = ( foo => 'victory' );
return %h<foo>;
@@ -19,7 +19,7 @@ plan 20;
# (They check that the parser doesn't abort, but they might still parse
# incorrectly.)
{
- sub foo(*@args, *%named) { 1 }
+ sub foo(*@args, *%named) { 1 } #OK not used
ok eval(q/foo; /), 'call with no args, no parens';
ok eval(q/foo(); /), 'call with no args, has parens';
@@ -25,7 +25,7 @@ try { 1.nonexisting_method; };
ok $!, 'Calling a nonexisting smethod sets $!';
my $called;
-sub foo(Str $s) { return $called++ };
+sub foo(Str $s) { return $called++ }; #OK not used
my @a;
try { foo(@a,@a) };
ok $!, 'Calling a subroutine with a nonmatching signature sets $!';
@@ -45,7 +45,7 @@ plan 12;
# &sub.signature should return a Siglist object
{
- sub foo1 ($a, $b) {}
+ sub foo1 ($a, $b) {} #OK not used
my $siglist = :($a, $b);
ok ~$siglist,
@@ -58,7 +58,7 @@ plan 12;
# Same as above, but more complex
{
- my sub foo (Num $a, $b?, *@rest) {}
+ my sub foo (Num $a, $b?, *@rest) {} #OK not used
my $siglist = :(Num $a, $b?, *@rest);
#?pugs todo 'feature'
@@ -221,7 +221,7 @@ eval_dies_ok('sub f { 3 } sub g { 3 }', 'semicolon or newline required between b
{
my $n = 1;
my $m = 2;
- sub infix:<++>($x, $y) { 42 }
+ sub infix:<++>($x, $y) { 42 } #OK not used
#'$n++$m' should be a syntax error
eval_dies_ok('$n++$m', 'infix requires space when ambiguous with postfix');
@@ -55,8 +55,8 @@ plan 83;
my $calls_c = 0;
my ($r, $ok);
multi mstest(Int $x) { $calls_a++; return $x }
- multi mstest(Str $x, Str $y) { $calls_b++ }
- multi mstest(Str $x) { $calls_c++ }
+ multi mstest(Str $x, Str $y) { $calls_b++ } #OK not used
+ multi mstest(Str $x) { $calls_c++ } #OK not used
$r = mstest(1&2 | 3);
is($calls_a, 3, 'correct multi-sub called right number of times');
is($calls_b, 0, 'incorrect multi-sub not called');
@@ -375,7 +375,7 @@ ok Mu & Mu ~~ Mu, 'Mu & Mu ~~ Mu works';
'for loop over junction in try block';
sub rt63686 {
- for any(1,2) -> $x {};
+ for any(1,2) -> $x {}; #OK not used
return 'happiness';
}
is rt63686(), 'happiness', 'for loop over junction in sub';
@@ -46,7 +46,7 @@ plan 28;
sub foo {
my $a is context = "foo";
- my $b is context := $a;
+ my $b is context := $a; #OK not used
return bar(); # && bar2();
}
@@ -243,7 +243,7 @@ eval_lives_ok 'my $x = 3; class A { has .$y = $x; }; say A.new.y',
{
#?rakudo skip 'RT 72814'
- lives_ok {my ::a $a}, 'typing a my-declared variable as ::a works.';
+ lives_ok {my ::a $a}, 'typing a my-declared variable as ::a works.'; #OK not used
}
# vim: ft=perl6
@@ -107,7 +107,7 @@ plan 38;
{
my $rhs_calls = 0;
sub impure_rhs {
- state $x = do { $rhs_calls++ }
+ state $x = do { $rhs_calls++ } #OK not used
}
impure_rhs() for 1..3;
is $rhs_calls, 1, 'RHS of state $x = ... only called once';
@@ -271,7 +271,7 @@ plan 38;
}
# Test for RT #67058
-sub bughunt1 { (state $svar) }
+sub bughunt1 { (state $svar) } #OK not used
{
sub bughunt2 { state $x //= 17; ++$x }
is bughunt2(), 18,
@@ -10,7 +10,7 @@ plan 8;
# "use fatal" is not standard, so we don't have to disable it here
my $was_after_fail = 0;
my $was_before_fail = 0;
- my $sub = sub { $was_before_fail++; my $exception = fail 42; $was_after_fail++ };
+ my $sub = sub { $was_before_fail++; my $exception = fail 42; $was_after_fail++ }; #OK not used
my $unthrown_exception = $sub();
# Note: We don't further access $unthrown_exception, so it doesn't get thrown
View
@@ -94,7 +94,7 @@ if (Mu) { flunk('if (Mu) {} failed'); } else { pass('if (Mu) {} works'); }
{
my $var = 9;
- my sub func( $a, $b, $c ) { $var };
+ my sub func( $a, $b, $c ) { $var }; #OK not used
if func 1, 2, 3 { $var = 4 } else { $var = 5 };
is $var, 4, 'if with no parens, and call a function without parenthesis';
}
@@ -9,7 +9,7 @@ plan 15;
{
# the multi being lifted
- multi sub mt(Any $x) { 'Any' }
+ multi sub mt(Any $x) { 'Any' } #OK not used
multi sub lt1() { lift mt('String') }
multi sub lt2() { lift mt(['Array']) }
@@ -20,7 +20,7 @@ class An::Action1 {
$!in-a++;
$!calls ~= 'a';
}
- method b($x) {
+ method b($x) { #OK not used
$!in-b++;
$!calls ~= 'b';
}
@@ -12,7 +12,7 @@ grammar Grammar::With::Signatures {
<fred: 2, 3>
}
- token fred($arg, $bar?) {
+ token fred($arg, $bar?) { #OK not used
| { $arg == 1 } 'bar'
| { $arg == 2 } 'foo'
}
@@ -5,10 +5,10 @@ plan *;
# RT 71754
{
my @called;
- multi rt71754( Num $x ) {
+ multi rt71754( Num $x ) { #OK not used
push @called, 'Num';
}
- multi rt71754( Int $x ) {
+ multi rt71754( Int $x ) { #OK not used
push @called, 'Int';
callsame;
}
@@ -4,8 +4,8 @@ use Test;
plan 6;
-multi testsub (Str $x, $y) { "Str" }
-multi testsub (Int $x, $y) { "Int" }
+multi testsub (Str $x, $y) { "Str" } #OK not used
+multi testsub (Int $x, $y) { "Int" } #OK not used
is testsub("a_str", 42), "Str", "basic MMD works (1)";
is testsub(23, 42), "Int", "basic MMD works (2)";
@@ -19,7 +19,7 @@ plan 14;
my multi bar() { 1 }
{
- my multi bar($x) { 2 }
+ my multi bar($x) { 2 } #OK not used
is(bar(), 1, 'outer lexical multi callable');
is(bar('syr'), 2, 'new inner lexical multi callable');
View
@@ -7,8 +7,8 @@ class A { }
class B { }
class C is A is B { }
proto foo($x) { 1 }
-multi foo(A $x) { 2 }
-multi foo(B $x) { 3 }
+multi foo(A $x) { 2 } #OK not used
+multi foo(B $x) { 3 } #OK not used
is(foo(A.new), 2, 'dispatch on class worked');
is(foo(B.new), 3, 'dispatch on class worked');
is(foo(C.new), 1, 'ambiguous dispatch fell back to proto');
@@ -17,10 +17,10 @@ is(foo(42), 1, 'dispatch with no possible candidates fell back to proto');
{
# Test that proto makes all further subs in the scope also be multi.
proto bar() { "proto" }
- sub bar($x) { 1 }
- multi bar($x, $y) { 2 }
- multi sub bar($x, $y, $z) { 3 }
- sub bar($x, $y, $z, $a) { 4 }
+ sub bar($x) { 1 } #OK not used
+ multi bar($x, $y) { 2 } #OK not used
+ multi sub bar($x, $y, $z) { 3 } #OK not used
+ sub bar($x, $y, $z, $a) { 4 } #OK not used
is bar(), "proto", "called the proto";
is bar(1), 1, "sub defined without multi has become one";
is bar(1,2), 2, "multi ... still works, though";
View
@@ -9,19 +9,19 @@ plan 34;
# multi sub with signature
multi sub foo() { "empty" }
-multi sub foo($a) { "one" }
+multi sub foo($a) { "one" } #OK not used
is(foo(), "empty", "multi sub with empty signature");
is(foo(42), "one", "multi sub with parameter list");
# multi sub without signature
multi sub bar { "empty" }
-multi sub bar($a) { "one" }
+multi sub bar($a) { "one" } #OK not used
is(bar(), "empty", "multi sub with no signature");
is(bar(42), "one", "multi sub with parameter list");
# multi without a routine type
multi baz { "empty" }
-multi baz($a) { "one" }
+multi baz($a) { "one" } #OK not used
is(baz(), "empty", "multi with no signature");
is(baz(42), "one", "multi with parameter list");
@@ -30,10 +30,10 @@ is(baz(42), "one", "multi with parameter list");
# ints means they are tied candidates as one isn't narrower than the other.
# (Note Int is narrower than Num - any two types where one is narrower than
# the other will do it, though.)
-multi foo(Int $a, Num $b) { 1 }
-multi foo(Num $a, Int $b) { 2 }
-multi bar(Int $a;; Num $b) { 1 }
-multi bar(Num $a;; Int $b) { 2 }
+multi foo(Int $a, Num $b) { 1 } #OK not used
+multi foo(Num $a, Int $b) { 2 } #OK not used
+multi bar(Int $a;; Num $b) { 1 } #OK not used
+multi bar(Num $a;; Int $b) { 2 } #OK not used
my $lived = 0;
try { foo(1,1); $lived = 1 }
is($lived, 0, "dispatch tied as expected");
@@ -56,27 +56,27 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
# note - example in ticket [perl #58948] a bit more elaborate
{
- multi sub max($a, $b, $c) {return 9}
+ multi sub max($a, $b, $c) {return 9} #OK not used
lives_ok { max(1, 2, 3) }, 'use multi method to override builtin lives';
is eval('max(1, 2, 3)'), 9, 'use multi method to override builtin';
}
# named and slurpy interaction - there have been bugs in the past on this front
{
- multi nsi_1(Int $x, Bool :$flag, *@vals) { "nsi 1" };
+ multi nsi_1(Int $x, Bool :$flag, *@vals) { "nsi 1" }; #OK not used
is nsi_1(1), 'nsi 1', 'interaction between named and slurpy (1)';
is nsi_1(1, 2, 3, 4, 5), 'nsi 1', 'interaction between named and slurpy (2)';
- multi nsi_2(Bool :$baz = Bool::False, *@vals) { "nsi 2" };
+ multi nsi_2(Bool :$baz = Bool::False, *@vals) { "nsi 2" }; #OK not used
is nsi_2(:baz(Bool::True), 1, 2, 3), 'nsi 2', 'interaction between named and slurpy (3)';
is nsi_2(1, 2, 3), 'nsi 2', 'interaction between named and slurpy (4)';
}
# RT #68234
{
- multi rt68234(:$key!) { 'with key' };
- multi rt68234(*%_) { 'unknown' };
+ multi rt68234(:$key!) { 'with key' }; #OK not used
+ multi rt68234(*%_) { 'unknown' }; #OK not used
is rt68234(:key), 'with key', 'can find multi method with key';
#?rakudo skip 'RT #68234'
is rt68234(:unknown), 'unknown', 'can find multi method with slurpy';
@@ -85,15 +85,15 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
# RT #68158
{
multi rt68158() { 1 }
- multi rt68158(*@x) { 2 }
+ multi rt68158(*@x) { 2 } #OK not used
is rt68158(), 1, 'non-slurpy wins over slurpy';
is rt68158(9), 2, 'slurpy called when non-slurpy can not bind';
}
# RT #64922
{
- multi rt64922($x, %h?) { 1 }
- multi rt64922(@x) { 2 }
+ multi rt64922($x, %h?) { 1 } #OK not used
+ multi rt64922(@x) { 2 } #OK not used
is rt64922(1), 1, 'optional parameter does not break type-based candidate sorting';
is rt64922([1,2]), 2, 'optional parameter does not break type-based candidate sorting';
}
Oops, something went wrong. Retry.

0 comments on commit 8dc7d4b

Please sign in to comment.