Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (36 sloc) 1.112 kb
297e783 [t] and [t/spec]
moritz authored
1 use v6;
2
db4bde7 [t/spec] add 'use MONKEY_TYPING' where appropriate
lwall authored
3 use MONKEY_TYPING;
4
297e783 [t] and [t/spec]
moritz authored
5 use Test;
6
1af085a [t/spec]
moritz authored
7 plan 11;
297e783 [t] and [t/spec]
moritz authored
8
95ea915 [t/spec] remove rest of "is also" on classes
moritz authored
9 augment class Array { method test_method { 1 }; };
10 augment class Hash { method test_method { 1 }; };
297e783 [t] and [t/spec]
moritz authored
11
12 my @named_array;
13
14 ok @named_array.test_method, "Uninitialized array";
15
16 @named_array = (1,2,3);
17
18 ok @named_array.test_method, "Populated array";
19
5b8dc6b [t] warning suppression
lwall authored
20 ok try { [].test_method }, "Bare arrayref";
297e783 [t] and [t/spec]
moritz authored
21
22
23 my $arrayref = [];
24
25 $arrayref = [];
26
27 ok $arrayref.test_method, "arrayref in a variable";
28
29 my %named_hash;
30
31 ok %named_hash.test_method, "Uninitialized hash";
32 %named_hash = (Foo => "bar");
33
34 ok %named_hash.test_method, "Populated hash";
35
5b8dc6b [t] warning suppression
lwall authored
36 ok try { ~{foo => "bar"}.test_method }, "Bare hashref";
297e783 [t] and [t/spec]
moritz authored
37
38
39 my $hashref = {foo => "bar"};
40
41 ok $hashref.test_method, "Named hashref";
42
43 # Now for pairs.
44
5b8dc6b [t] warning suppression
lwall authored
45 is(try { (:key<value>).value; }, 'value', "method on a bare pair");
297e783 [t] and [t/spec]
moritz authored
46
47 my $pair = :key<value>;
48
49 is $pair.value, 'value', "method on a named pair";
1af085a [t/spec]
moritz authored
50
51 {
c7210b7 [t/spec] Fudge out Hash extension tests, unfudge a test, change type of ...
colomon authored
52 augment class Parcel {
1af085a [t/spec]
moritz authored
53 method twice {
54 gather {
8657a3a @sorear Unfudge a few niecza tests
sorear authored
55 take $_ * 2 for self.list;
1af085a [t/spec]
moritz authored
56 }
57 }
58 }
59
c7210b7 [t/spec] Fudge out Hash extension tests, unfudge a test, change type of ...
colomon authored
60 is (1, 2, 3).twice.join('|'), "2|4|6", 'can extend class Parcel';
1af085a [t/spec]
moritz authored
61 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
62
63 # vim: ft=perl6
Something went wrong with that request. Please try again.