Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (54 sloc) 2.199 kB
8485f44 [t/spec] fix some svn props
moritz authored
1 use v6;
2
3 use Test;
4
5 plan 20;
6
7 # TODO: *really* need a better smartlink
75bf7cb @diakopter fix all the remaining S02/Literals smartlinks I broke by adding headi…
diakopter authored
8 # L<S02/Bare identifiers/"If the unrecognized subroutine name">
8485f44 [t/spec] fix some svn props
moritz authored
9
10 # These tests are for parse-fails:
11 # (They check that the parser doesn't abort, but they might still parse
12 # incorrectly.)
13 {
8dc7d4b [t/spec] mark various tests that intentionally declare things that ar…
lwall authored
14 sub foo(*@args, *%named) { 1 } #OK not used
8485f44 [t/spec] fix some svn props
moritz authored
15
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
16 ok EVAL(q/foo; /), 'call with no args, no parens';
17 ok EVAL(q/foo(); /), 'call with no args, has parens';
18 ok EVAL(q/&foo.(); /), 'call with no args, has dot and parens';
19 ok EVAL(q/&foo\ .(); /), 'call with no args, has long dot and parens';
6845135 [t/spec] eval should eval things into the namespace of its caller; co…
jnthn authored
20
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
21 ok EVAL(q/foo 1; /), 'call with one arg, no parens';
22 ok EVAL(q/foo(1); /), 'call with one arg, has parens';
23 ok EVAL(q/&foo.(1); /), 'call with one arg, has dot and parens';
24 ok EVAL(q/&foo\ .(1);/), 'call with one arg, has long dot and parens';
08b5de5 @lizmat s/throws_like/throws-like/g
lizmat authored
25 throws-like { EVAL q/foo'...'; / },
89c2de2 @lizmat Another batch of (eval_|)dies_ok -> throws_like
lizmat authored
26 X::Syntax::Confused,
27 'call with one arg, has no space and no parens';
8485f44 [t/spec] fix some svn props
moritz authored
28
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
29 ok EVAL(q/foo 1, 2; /), 'call with two args, no parens';
30 ok EVAL(q/foo(1, 2);/), 'call with two args, has parens';
8485f44 [t/spec] fix some svn props
moritz authored
31
08b5de5 @lizmat s/throws_like/throws-like/g
lizmat authored
32 throws-like { EVAL q/foo:bar; / },
6aeac74 @lizmat This migration turned out to be ok after all
lizmat authored
33 X::Undeclared::Symbols,
89c2de2 @lizmat Another batch of (eval_|)dies_ok -> throws_like
lizmat authored
34 'call with adverb after no space';
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
35 ok EVAL(q/foo :bar; /), 'call with adverb after space';
8485f44 [t/spec] fix some svn props
moritz authored
36
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
37 ok EVAL(q/foo(:bar); /), 'call with adverb in parens';
38 ok EVAL(q/&foo.(:bar); /), 'call with adverb in dotted-parens';
39 ok EVAL(q/&foo\.(:bar);/), 'call with adverb in long-dotted parens';
8485f44 [t/spec] fix some svn props
moritz authored
40 }
41
42
43 # These tests are for mis-parses:
44 {
45 sub succ($x) { $x + 1 }
46
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
47 is(EVAL(q/succ (1+2) * 30;/), 91, "parens after space aren't call-parens");
b56e374 @moritz make an unrelated test not rely on the absence of methods on Nil
moritz authored
48 $_ = sub ($x) { $x - 1 };
49 is (succ .(1+2) * 30), 61, 'parsed as method call on $_';
8485f44 [t/spec] fix some svn props
moritz authored
50 }
51 {
52 sub first() { "first" }
189b4db [t/spec] cosmetic cleaning: remove trailing space
wollmers authored
53
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
54 is(EVAL(q/first.uc/), 'FIRST', '`first.second` means `(first()).second()`');
8485f44 [t/spec] fix some svn props
moritz authored
55 }
56
57 {
0bb81f8 @FROGGS eval => EVAL in S02, take 1
FROGGS authored
58 is(EVAL(q/"hello".substr: 1, 2/), "el", "listop method");
8485f44 [t/spec] fix some svn props
moritz authored
59
189b4db [t/spec] cosmetic cleaning: remove trailing space
wollmers authored
60 # foo $bar.baz: quux
8485f44 [t/spec] fix some svn props
moritz authored
61 # should be (and is currently) interpreted as:
62 # foo($bar.baz(quux))
63 # where the alternate interpretation can be achieved by:
64 # foo ($bar.baz): quux
65 # which is interpreted as
66 # $bar.baz.foo(quux)
67 # but we need tests, tests, tests! XXX
68 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
69
70 # vim: ft=perl6
Something went wrong with that request. Please try again.