Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 74 lines (56 sloc) 2.349 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 headings...
diakopter authored
8 # L<S02/Bare identifiers/"If the unrecognized subroutine name">
8485f44 [t/spec] fix some svn props
moritz authored
9
7922e91 @KrisShannon Revert my last commit.
KrisShannon authored
10 #?pugs emit if $?PUGS_BACKEND ne "BACKEND_PUGS" {
11 #?pugs emit skip_rest "PIL2JS and PIL-Run do not support eval() yet.";
12 #?pugs emit exit;
13 #?pugs emit }
8485f44 [t/spec] fix some svn props
moritz authored
14
15 # These tests are for parse-fails:
16 # (They check that the parser doesn't abort, but they might still parse
17 # incorrectly.)
18 {
8dc7d4b [t/spec] mark various tests that intentionally declare things that are n...
lwall authored
19 sub foo(*@args, *%named) { 1 } #OK not used
8485f44 [t/spec] fix some svn props
moritz authored
20
6845135 [t/spec] eval should eval things into the namespace of its caller; corre...
jnthn authored
21 ok eval(q/foo; /), 'call with no args, no parens';
22 ok eval(q/foo(); /), 'call with no args, has parens';
23 ok eval(q/&foo.(); /), 'call with no args, has dot and parens';
24 ok eval(q/&foo\ .(); /), 'call with no args, has long dot and parens';
25
26 ok eval(q/foo 1; /), 'call with one arg, no parens';
27 ok eval(q/foo(1); /), 'call with one arg, has parens';
28 ok eval(q/&foo.(1); /), 'call with one arg, has dot and parens';
29 ok eval(q/&foo\ .(1);/), 'call with one arg, has long dot and parens';
8485f44 [t/spec] fix some svn props
moritz authored
30 #?pugs todo 'unspecced'
a238bb3 @moritz remove bogus test
moritz authored
31 dies_ok { eval(q/foo'bar'; /) }, 'call with one arg, has no space and no parens';
8485f44 [t/spec] fix some svn props
moritz authored
32
6845135 [t/spec] eval should eval things into the namespace of its caller; corre...
jnthn authored
33 ok eval(q/foo 1, 2; /), 'call with two args, no parens';
34 ok eval(q/foo(1, 2);/), 'call with two args, has parens';
8485f44 [t/spec] fix some svn props
moritz authored
35
e8eb581 @coke niecza fudging
coke authored
36 #?niecza skip 'Undeclared routine "foo:bar"'
6845135 [t/spec] eval should eval things into the namespace of its caller; corre...
jnthn authored
37 ok eval(q/foo:bar; /), 'call with adverb after no space';
38 ok eval(q/foo :bar; /), 'call with adverb after space';
8485f44 [t/spec] fix some svn props
moritz authored
39
6845135 [t/spec] eval should eval things into the namespace of its caller; corre...
jnthn authored
40 ok eval(q/foo(:bar); /), 'call with adverb in parens';
41 ok eval(q/&foo.(:bar); /), 'call with adverb in dotted-parens';
42 ok eval(q/&foo\.(:bar);/), 'call with adverb in long-dotted parens';
8485f44 [t/spec] fix some svn props
moritz authored
43 }
44
45
46 # These tests are for mis-parses:
47 {
48 sub succ($x) { $x + 1 }
49
50 is(eval(q/succ (1+2) * 30;/), 91, "parens after space aren't call-parens");
f954d29 @coke pugs fudge recent tests
coke authored
51 #?pugs todo
0eba93a @felher rewrite tests that rely on Exception to return False on .Bool
felher authored
52 dies_ok { eval q/succ .(1+2) * 30;/ } , 'parsed as method call on $_';
8485f44 [t/spec] fix some svn props
moritz authored
53 }
54 {
55 sub first() { "first" }
189b4db [t/spec] cosmetic cleaning: remove trailing space
wollmers authored
56
8485f44 [t/spec] fix some svn props
moritz authored
57 is(eval(q/first.uc/), 'FIRST', '`first.second` means `(first()).second()`');
58 }
59
60 {
61 is(eval(q/"hello".substr: 1, 2/), "el", "listop method");
62
189b4db [t/spec] cosmetic cleaning: remove trailing space
wollmers authored
63 # foo $bar.baz: quux
8485f44 [t/spec] fix some svn props
moritz authored
64 # should be (and is currently) interpreted as:
65 # foo($bar.baz(quux))
66 # where the alternate interpretation can be achieved by:
67 # foo ($bar.baz): quux
68 # which is interpreted as
69 # $bar.baz.foo(quux)
70 # but we need tests, tests, tests! XXX
71 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
72
73 # vim: ft=perl6
Something went wrong with that request. Please try again.