Skip to content

Commit

Permalink
s/throws_like/throws-like/g
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed May 19, 2015
1 parent a87fde4 commit 08b5de5
Show file tree
Hide file tree
Showing 155 changed files with 751 additions and 751 deletions.
12 changes: 6 additions & 6 deletions S02-lexical-conventions/comments.t
Expand Up @@ -64,16 +64,16 @@ plan 51;
#?niecza skip 'Opening bracket is required for #` comment'
{

throws_like { EVAL "3 * #` (invalid comment) 2" },
throws-like { EVAL "3 * #` (invalid comment) 2" },
X::Comp::AdHoc, # no exception type yet
"no space allowed between '#`' and '('";
throws_like { EVAL "3 * #`\t[invalid comment] 2" },
throws-like { EVAL "3 * #`\t[invalid comment] 2" },
X::Comp::AdHoc, # no exception type yet
"no tab allowed between '#`' and '['";
throws_like { EVAL "3 * #` \{invalid comment\} 2" },
throws-like { EVAL "3 * #` \{invalid comment\} 2" },
X::Comp::AdHoc, # no exception type yet
"no spaces allowed between '#`' and '\{'";
throws_like { EVAL "3 * #`\n<invalid comment> 2" },
throws-like { EVAL "3 * #`\n<invalid comment> 2" },
X::Syntax::Confused,
"no spaces allowed between '#`' and '<'";

Expand Down Expand Up @@ -160,7 +160,7 @@ plan 51;
# L<S02/Comments in Unspaces and vice versa/"comment may not contain an unspace">
#?niecza skip 'Excess arguments to CORE eval'
{
throws_like { EVAL '$a = #`\ (comment) 32' },
throws-like { EVAL '$a = #`\ (comment) 32' },
X::Undeclared,
"comments can't contain unspace";
}
Expand All @@ -175,7 +175,7 @@ plan 51;

{
my $a = Nil;
throws_like { EVAL '$a = q# 32 #;' }, X::Comp::AdHoc, 'misuse of # as quote delimiters';
throws-like { EVAL '$a = q# 32 #;' }, X::Comp::AdHoc, 'misuse of # as quote delimiters';
ok !$a.defined, "The # character can't be used as quote delimiters";
}

Expand Down
16 changes: 8 additions & 8 deletions S02-lexical-conventions/minimal-whitespace.t
Expand Up @@ -7,37 +7,37 @@ plan 9;
# L<S03/Minimal whitespace DWIMmery/Whitespace is no longer allowed before>

my @arr = <1 2 3 4 5>;
throws_like { EVAL '@arr [0]' },
throws-like { EVAL '@arr [0]' },
X::Syntax::Missing,
'array with space before opening brackets does not work';

my %hash = a => 1, b => 2;
throws_like { EVAL '%hash <a>' },
throws-like { EVAL '%hash <a>' },
X::Comp::AdHoc, # no exception type yet
'hash with space before opening brackets does not work (1)';
throws_like { EVAL '%hash {"a"}' },
throws-like { EVAL '%hash {"a"}' },
X::Comp::AdHoc, # no exception type yet
'hash with space before opening braces does not work (2)';

class Thing {method whatever (Int $a) {3 * $a}}
throws_like { EVAL 'Thing .new' },
throws-like { EVAL 'Thing .new' },
X::Syntax::Confused,
'whitespace is not allowed before . after class name';
throws_like { EVAL 'Thing. new' },
throws-like { EVAL 'Thing. new' },
X::Obsolete,
'whitespace is not allowed after . after class name';

my $o = Thing.new;
throws_like { EVAL '$o .whatever(5)' },
throws-like { EVAL '$o .whatever(5)' },
X::Syntax::Confused,
'whitespace is not allowed before . before method';
throws_like { EVAL '$o. whatever(5)' },
throws-like { EVAL '$o. whatever(5)' },
X::Obsolete,
'whitespace is not allowed after . before method';

lives_ok { EVAL 'my @rt80330; [+] @rt80330' },
'a [+] with whitespace works';
throws_like { EVAL 'my @rt80330; [+]@rt80330' },
throws-like { EVAL 'my @rt80330; [+]@rt80330' },
X::Syntax::Confused,
'a [+] without whitespace dies';

Expand Down
6 changes: 3 additions & 3 deletions S02-lexical-conventions/sub-block-parsing.t
Expand Up @@ -26,14 +26,14 @@ ok(sub{ 42 }(), 'sub{...}() works'); # TODO: clarify
}

# RT #76432
throws_like { EVAL q[
throws-like { EVAL q[
sub x { die }
x();
] },
Exception, # no exception object yet
'block parsing works with newline';

throws_like { EVAL q[
throws-like { EVAL q[
sub x { die };
x();
] },
Expand All @@ -42,7 +42,7 @@ throws_like { EVAL q[

# RT #85844
{
throws_like { EVAL 'sub foo;' },
throws-like { EVAL 'sub foo;' },
X::UnitScope::Invalid,
'RT #85844';
}
Expand Down
2 changes: 1 addition & 1 deletion S02-lexical-conventions/unicode.t
Expand Up @@ -130,7 +130,7 @@ lives_ok { EVAL "q\x298d test \x298e" },
"Unicode open-298d maps to close-298e";
lives_ok { EVAL "q\x301d test \x301e" },
"Unicode open-301d maps to close-301e";
throws_like { EVAL "q\x301d test \x301f" },
throws-like { EVAL "q\x301d test \x301f" },
Exception,
"Unicode open-301d does not map to close-301f";
lives_ok { EVAL "q\x2018 test \x2019" },
Expand Down
18 changes: 9 additions & 9 deletions S02-lexical-conventions/unspace.t
Expand Up @@ -70,13 +70,13 @@ is((foo\.lc ), 'a', 'short unspace');
is((foo\ .lc ), 'a', 'unspace');
is((foo\ ('x')), 'x', "unspace before arguments");
is((foo \ .lc), 'b', 'not a unspace');
throws_like { EVAL 'fo\ o.lc' },
throws-like { EVAL 'fo\ o.lc' },
X::Syntax::Confused,
'unspace not allowed in identifier';
is((foo\ .lc), 'a', 'longer dot');
is((foo\#`( comment ).lc), 'a', 'unspace with embedded comment');
#?rakudo todo 'NYI RT #125072'
throws_like { EVAL 'foo\#\ ( comment ).lc' },
throws-like { EVAL 'foo\#\ ( comment ).lc' },
Exception,
'unspace can\'t hide space between # and opening bracket';
is((foo\ # comment
Expand Down Expand Up @@ -191,7 +191,7 @@ end comment #5
# L<S04/"Statement-ending blocks"/"Because subroutine declarations are expressions">
#XXX probably shouldn't be in this file...

throws_like { EVAL 'sub f { 3 } sub g { 3 }' },
throws-like { EVAL 'sub f { 3 } sub g { 3 }' },
X::Syntax::Confused,
'semicolon or newline required between blocks';

Expand Down Expand Up @@ -229,7 +229,7 @@ throws_like { EVAL 'sub f { 3 } sub g { 3 }' },
sub infix:<++>($x, $y) { 42 } #OK not used

#'$n++$m' should be a syntax error
throws_like { EVAL '$n++$m' },
throws-like { EVAL '$n++$m' },
X::Syntax::Confused,
'infix requires space when ambiguous with postfix';
is($n, 1, 'check $n');
Expand All @@ -250,13 +250,13 @@ throws_like { EVAL 'sub f { 3 } sub g { 3 }' },

#These should all be postfix syntax errors
$n = 1; $m = 2;
throws_like { EVAL '$n.++ $m' },
throws-like { EVAL '$n.++ $m' },
X::Syntax::Confused,
'postfix dot w/ infix ambiguity';
throws_like { EVAL '$n\ ++ $m' },
throws-like { EVAL '$n\ ++ $m' },
X::Comp,
'postfix unspace w/ infix ambiguity';
throws_like { EVAL '$n\ .++ $m' },
throws-like { EVAL '$n\ .++ $m' },
X::Comp,
'postfix unspace w/ infix ambiguity';
is($n, 1, 'check $n');
Expand All @@ -269,7 +269,7 @@ throws_like { EVAL 'sub f { 3 } sub g { 3 }' },
is($m, 2, 'check $m');

$n = 1;
throws_like { EVAL '$n ++' },
throws-like { EVAL '$n ++' },
X::Comp::AdHoc,
'postfix requires no space';
is($n, 1, 'check $n');
Expand All @@ -289,7 +289,7 @@ throws_like { EVAL 'sub f { 3 } sub g { 3 }' },
# L<S02/"Bracketing Characters"/"U+301D codepoint has two closing alternatives">
#?niecza skip 'Unable to resolve method id in class Str'
is((foo\#`〝 comment 〞.lc), 'a', 'unspace with U+301D/U+301E comment');
throws_like { EVAL 'foo\#`〝 comment 〟.id' },
throws-like { EVAL 'foo\#`〝 comment 〟.id' },
X::Comp::AdHoc,
'unspace with U+301D/U+301F is invalid';

Expand Down
2 changes: 1 addition & 1 deletion S02-literals/adverbs.t
Expand Up @@ -21,7 +21,7 @@ plan 32;
is-deeply (:%a), (a => %a), ":%a works";
is-deeply (:&a), (a => &a), ":&a works";
is-deeply (:42nd), (nd => 42), "Basic numeric adverb works";
throws_like { EVAL ':69th($_)' },
throws-like { EVAL ':69th($_)' },
X::Comp::AdHoc,
"Numeric adverb can't have an extra value";

Expand Down
16 changes: 8 additions & 8 deletions S02-literals/char-by-number.t
Expand Up @@ -13,10 +13,10 @@ is("\x[20]", ' ', '\x[20] normal space');
is("\x[a0]", chr(0xa0), '\x[a0] non-breaking space');
is("\x[263a]", '', '\x[263a] wide hex character (SMILEY)');
is("\x[6211]", '', '\x[597d] wide hex character (Chinese char)');
throws_like { EVAL '"\x[6211"' },
throws-like { EVAL '"\x[6211"' },
X::Comp::AdHoc,
'broken "\x[6211"';
throws_like { EVAL '"\x [6211]"' },
throws-like { EVAL '"\x [6211]"' },
X::Backslash::UnrecognizedSequence,
'broken "\x [6211]"';

Expand All @@ -31,10 +31,10 @@ is("\o[40]", ' ', '\o[40] normal space');
is("\o[240]", chr(160), '\o[240] non-breaking space');
is("\o[23072]", '', '\o[23072] wide hex character (SMILEY)');
is("\o[61021]", '', '\o[61021] wide hex character (Chinese char)');
throws_like { EVAL '"\o[6211"' },
throws-like { EVAL '"\o[6211"' },
X::Comp::AdHoc,
'broken "\o[6211"';
throws_like { EVAL '"\o [6211]"' },
throws-like { EVAL '"\o [6211]"' },
X::Backslash::UnrecognizedSequence,
'broken "\o [6211]"';

Expand All @@ -49,10 +49,10 @@ is("\c[32]", ' ', '\c[32] normal space');
is("\c[160]", chr(160), '\c[240] non-breaking space');
is("\c[9786]", '', '\c[9786] wide hex character (SMILEY)');
is("\c[25105]", '', '\c[25105] wide hex character (Chinese char)');
throws_like { EVAL '"\c[6211"' },
throws-like { EVAL '"\c[6211"' },
X::Comp::AdHoc,
'broken "\c[6211"';
throws_like { EVAL '"\c [6211]"' },
throws-like { EVAL '"\c [6211]"' },
X::Comp::AdHoc,
'broken "\c [6211]"';

Expand All @@ -63,10 +63,10 @@ is("\c65,66,67", 'A,66,67', '\clist not valid');
# L<S02/Radix interpolation/"\123 form">

{
throws_like { EVAL q{"\123"} },
throws-like { EVAL q{"\123"} },
X::Backslash::UnrecognizedSequence,
'"\123" form is no longer valid Perl 6';
throws_like { EVAL q{"\10"} },
throws-like { EVAL q{"\10"} },
X::Backslash::UnrecognizedSequence,
'"\10" form is no longer valid Perl 6';
}
Expand Down
14 changes: 7 additions & 7 deletions S02-literals/listquote.t
Expand Up @@ -22,13 +22,13 @@ ok( [1,2,3].join<abc> ~~ Failure , '.join<abc> parses and fails');
my @y = try { ({:a<1>, :b(2)}<a b c>) };
ok(@y eqv ["1",2,Any], '{...}<a b c> is hash subscript');

throws_like { EVAL '({:a<1>, :b(2)} <1 2 3>)' },
throws-like { EVAL '({:a<1>, :b(2)} <1 2 3>)' },
X::Syntax::Confused,
'{...} <...> parsefail';

ok( ?((1 | 3) < 3), '(...) < 3 no parsefail');

throws_like { EVAL '(1 | 3)<3' },
throws-like { EVAL '(1 | 3)<3' },
X::Comp::AdHoc,
'()<3 parsefail';

Expand All @@ -37,11 +37,11 @@ throws_like { EVAL '(1 | 3)<3' },
# ok($!, 'print < 3 parsefail');


throws_like { EVAL ':foo <1 2 3>' },
throws-like { EVAL ':foo <1 2 3>' },
X::Syntax::Confused,
':foo <1 2 3> parsefail';

throws_like { EVAL ':foo <3' },
throws-like { EVAL ':foo <3' },
X::Multi::NoMatch,
'<3 is comparison, but dies at run time';

Expand All @@ -64,18 +64,18 @@ is($p, ~('foo' => (1,2,3)), ':foo<1 2 3> is pair of list');

# L<S02/Forcing item context/"The degenerate case <> is disallowed">

throws_like { EVAL '<>' },
throws-like { EVAL '<>' },
X::Obsolete,
'bare <> is disallowed';
throws_like { EVAL '<STDIN>' },
throws-like { EVAL '<STDIN>' },
X::Obsolete,
'<STDIN> is disallowed';

# L<S02/Quoting forms/"is autopromoted into">
{
my $c = <a b c>;
isa-ok($c, Parcel, 'List in scalar context becomes a Capture');
throws_like {$c.push: 'd'},
throws-like {$c.push: 'd'},
X::Multi::NoMatch,
'... which is immutable';
}
Expand Down
2 changes: 1 addition & 1 deletion S02-literals/misc-interpolation.t
Expand Up @@ -106,7 +106,7 @@ is("x \c[65,66,67]] x", "x ABC] x", "\\c[] should not eat following ]s");
'interpolation of indirect method calls (different quotes)';
is "|$x."f"()|", '|int|', #OK use of quotes
'interpolation of indirect method calls (same quotes)';
throws_like { EVAL q["|$x."f "()"] },
throws-like { EVAL q["|$x."f "()"] },
X::Syntax::Confused,
'... but whitespace is not allowed';
}
Expand Down
28 changes: 14 additions & 14 deletions S02-literals/pairs.t
Expand Up @@ -71,38 +71,38 @@ sub f2 (:$a!) { WHAT($a) }
isa-ok $f2(:a), Bool, "in '\$f2(:a)', ':a' is a named";
isa-ok $f2.(:a), Bool, "in '\$f2.(:a)', ':a' is a named";

throws_like 'f2("a" => 42)',
throws-like 'f2("a" => 42)',
Exception,
"'\"a\" => 42' is a pair";
throws_like 'f2(("a") => 42)',
throws-like 'f2(("a") => 42)',
Exception,
"'(\"a\") => 42' is a pair";
throws_like 'f2((a => 42))',
throws-like 'f2((a => 42))',
Exception,
"'(a => 42)' is a pair";
throws_like 'f2(("a" => 42))',
throws-like 'f2(("a" => 42))',
Exception,
"'(\"a\" => 42)' is a pair";
throws_like 'f2((:a(42)))',
throws-like 'f2((:a(42)))',
Exception,
"'(:a(42))' is a pair";
throws_like 'f2((:a))',
throws-like 'f2((:a))',
Exception,
"'(:a)' is a pair";
throws_like '&f2.((:a))',
throws-like '&f2.((:a))',
Exception,
'in \'&f2.((:a))\', \'(:a)\' is a pair';

throws_like '$f2((:a))',
throws-like '$f2((:a))',
Exception,
"in '\$f2((:a))', '(:a)' is a pair";
throws_like '$f2.((:a))',
throws-like '$f2.((:a))',
Exception,
"in '\$f2.((:a))', '(:a)' is a pair";
throws_like '$f2(((:a)))',
throws-like '$f2(((:a)))',
Exception,
"in '\$f2(((:a)))', '(:a)' is a pair";
throws_like '$f2.(((:a)))',
throws-like '$f2.(((:a)))',
Exception,
"in '\$f2.(((:a)))', '(:a)' is a pair";
}
Expand Down Expand Up @@ -135,7 +135,7 @@ sub f7 (:$bar!) { WHAT($bar) }
{
my $bar = 'bar';

throws_like 'f7($bar => 42)',
throws-like 'f7($bar => 42)',
Exception,
"variables cannot be keys of syntactical pairs (1)";
}
Expand All @@ -144,7 +144,7 @@ sub f8 (:$bar!) { WHAT($bar) }
{
my @array = <bar>;

throws_like 'f8(@array => 42)',
throws-like 'f8(@array => 42)',
Exception,
"variables cannot be keys of syntactical pairs (2)";
}
Expand All @@ -153,7 +153,7 @@ sub f9 (:$bar!) { WHAT($bar) }
{
my $arrayref = <bar>;

throws_like 'f9($arrayref => 42)',
throws-like 'f9($arrayref => 42)',
Exception,
"variables cannot be keys of syntactical pairs (3)";
}
Expand Down

0 comments on commit 08b5de5

Please sign in to comment.