- Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathsigils-and-types.t
82 lines (66 loc) · 2.13 KB
/
sigils-and-types.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
useTest;
plan26;
my$scalar;
ok$scalar.WHAT===Any, 'unitialized $var does Mu';
$scalar=1;
ok$scalar~~Any, 'value contained in a $var does Mu';
{
my@array;
does-ok@array, Positional, 'unitialized @var does Positional';
}
{
my@array= [];
does-ok@array, Positional, 'value contained in a @var does Positional';
}
{
my@array=1;
does-ok@array, Positional, 'generic val in a @var is converted to Positional';
}
does-okEVAL('List'), Positional, "List does Positional";
does-okEVAL('Array'), Positional, "Array does Positional";
does-okEVAL('Range'), Positional, "Range does Positional";
does-okEVAL('Buf'), Positional, "Buf does Positional";
#?rakudo todo "Capture does Positional"
does-okEVAL('Capture'), Positional, "Capture does Positional";
my%hash;
does-ok%hash, Associative, 'uninitialized %var does Associative';
%hash=a =>1;
does-ok%hash, Associative, 'value in %var does Associative';
does-okEVAL('Pair'), Associative, "Pair does Associative";
does-okEVAL('Set'), Associative, "Set does Associative";
does-okEVAL('Bag'), Associative, "Bag does Associative";
does-okEVAL('QuantHash'), Associative, "QuantHash does Associative";
#?rakudo todo "Capture does Associative"
does-okEVAL('Capture'), Associative, "Capture does Associative";
subfoo {}
does-ok&foo, Callable, 'a Sub does Callable';
{
mymethodmeth {}
does-ok&meth, Callable, 'a Method does Callable';
}
proto mul(|) {*}
multimul {}
does-ok&mul, Callable, 'a multi does Callable';
proto pro {}
does-ok&pro, Callable, 'a proto does Callable';
# &token, &rule return a Method?
{
mytokenbar {<?>}
does-ok&bar, Callable, 'a token does Callable';
myrulebaz {<?>}
does-ok&baz, Callable, 'a rule does Callable';
}
# https://github.com/Raku/old-issue-tracker/issues/1312
{
suba { return'a' };
subb { return'b' };
dies-ok { &a=&b }, 'cannot just assign &b to &a';
is a(), 'a', 'and the correct function is still in place';
}
# https://github.com/Raku/old-issue-tracker/issues/1724
{
subf() { '42' };
my$x=&f;
is &$x(), '42', 'can use &$x() for invoking';
}
# vim: expandtab shiftwidth=4