Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 59 lines (49 sloc) 2.093 kB
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
1 use v6;
2 use Test;
3
81ceef9 [t/spec]: Update plan in typecasting-long.t .
pmichaud authored
4 plan 16;
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
5
636db57 [t/spec] fix all occurrences of @@ one way or another
lwall authored
6 # L<S13/"Type Casting"/"method postcircumfix:<{ }> (**@slice) {...}">
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
7 # basic tests to see if the methods overload correctly.
8
9 {
f6386b1 [t/spec/S13-overloading/typecasting-long.t] align the test with the s…
ruoso authored
10 my multi testsub ($a,$b) {
11 return 1;
12 }
13 my multi testsub ($a) {
14 return 2;
15 }
16 my multi testsub () {
17 return 3;
18 }
a29196f [gsoc_spectest] s/module/class/ in typecasting-long.t. Added typecast…
Auzon authored
19 class TypeCastSub {
6476383 [t/spec] Correct a 5-o and unfudge 4 tests that Rakudo can now pass.
jnthn authored
20 method postcircumfix:<( )> ($capture) {return 'pretending to be a sub ' ~ testsub(|$capture) }
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
21 }
22
23 my $thing = TypeCastSub.new;
f6386b1 [t/spec/S13-overloading/typecasting-long.t] align the test with the s…
ruoso authored
24 is($thing(), 'pretending to be a sub 3', 'overloaded () call works');
25 is($thing.(), 'pretending to be a sub 3', 'overloaded .() call works');
26 is($thing.(1), 'pretending to be a sub 2', 'overloaded .() call works');
27 is($thing.(1,2), 'pretending to be a sub 1', 'overloaded .() call works');
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
28 }
29
30 {
a29196f [gsoc_spectest] s/module/class/ in typecasting-long.t. Added typecast…
Auzon authored
31 class TypeCastArray {
1bbab36 [t/spec] Simplify some signatures; we're not testing slices or taking…
jnthn authored
32 method postcircumfix:<[ ]> (*@slice) {return 'pretending to be an array'}
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
33 }
34
35 my $thing = TypeCastArray.new;
36 is($thing[1], 'pretending to be an array', 'overloaded [] call works');
37 is($thing[2,3], 'pretending to be an array', 'overloaded [] call works (slice)');
38 is($thing.[4], 'pretending to be an array', 'overloaded .[] call works');
39 is($thing.[5,6], 'pretending to be an array', 'overloaded .[] call works (slice)');
40 }
41
42 {
a29196f [gsoc_spectest] s/module/class/ in typecasting-long.t. Added typecast…
Auzon authored
43 class TypeCastHash {
1bbab36 [t/spec] Simplify some signatures; we're not testing slices or taking…
jnthn authored
44 method postcircumfix:<{ }> (*@slice) {return 'pretending to be a hash'}
69a5550 [gsoc_spectest] Simplistic S13 (overloading) typecasting tests (long …
Auzon authored
45 }
46
47 my $thing = TypeCastHash.new;
48 is($thing{'a'}, 'pretending to be a hash', 'overloaded {} call works');
49 is($thing{'b','c'}, 'pretending to be a hash', 'overloaded {} call works (slice)');
50 is($thing.{'d'}, 'pretending to be a hash', 'overloaded .{} call works');
51 is($thing.{'e','f'}, 'pretending to be a hash', 'overloaded .{} call works (slice)');
52 is($thing<a>, 'pretending to be a hash', 'overloaded <> call works');
53 is($thing<b c>, 'pretending to be a hash', 'overloaded <> call works (slice)');
54 is($thing.<d>, 'pretending to be a hash', 'overloaded .<> call works');
55 is($thing.<e f>, 'pretending to be a hash', 'overloaded .<> call works (slice)');
56 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
57
58 # vim: ft=perl6
Something went wrong with that request. Please try again.