Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 51 lines (41 sloc) 1.063 kb
dcee930 [t] move macro tests to spec/ and unspecced/
moritz authored
1 use v6;
2
3 use Test;
4
820912f [t/spec] more smartlinks; less than 100 remain without smartlinks
moritz authored
5 # L<S06/Macros>
dcee930 [t] move macro tests to spec/ and unspecced/
moritz authored
6
7 plan 8;
8
9 {
10 my $was_in_macro;
11 macro dollar_foo { $was_in_macro = 1; '$COMPILING::foo' }
12 is $was_in_macro, 1, "string returning macro was called at compile time";
13 my $foo = 42;
b6ba504 Will Coleda pugs fudges
coke authored
14 #?pugs todo
dcee930 [t] move macro tests to spec/ and unspecced/
moritz authored
15 is dollar_foo, $foo, "simple string returning macro (1)";
16 dollar_foo() = 23;
b6ba504 Will Coleda pugs fudges
coke authored
17 #?pugs todo
dcee930 [t] move macro tests to spec/ and unspecced/
moritz authored
18 is $foo, 23, "simple string returning macro (2)";
19 }
20
21 {
22 my $ret = eval '
23 macro plus_3 { "+ 3" }
24 42 plus_3;
25 ';
ba8e84a [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
26 #?pugs todo 'feature'
27 is $ret, 45, "simple string returning macro (3)";
dcee930 [t] move macro tests to spec/ and unspecced/
moritz authored
28 };
29
30 {
31 macro four { '4' }
32 my $foo = 100 + four;
33 is $foo, 104, "simple string returning macro (4)";
34 }
35
36 {
37 macro prefix_1000 (Int $x) { "1000$x" }
38 is prefix_1000(42), 100042, "simple string returning macro (5)";
39 }
40
41 {
42 my $was_in_macro;
43 macro prefix_2000 (Int $x) { $was_in_macro = 1; "2000$x" }
44 is $was_in_macro, 1,
45 "simple string returning macro without argparens is parsed correctly (1)";
46 is (prefix_2000 42), 200042,
47 "simple string returning macro without argparens is parsed correctly (2)";
48 }
820912f [t/spec] more smartlinks; less than 100 remain without smartlinks
moritz authored
49
50 # vim: ft=perl6
Something went wrong with that request. Please try again.