|
Revision 24767, 1.1 kB
(checked in by moritz, 5 days ago)
|
|
[t] and [t/spec]
- more tests for slurpy args + is copy/is rw
- moved macro test to spec/
- moved closure trait tests to spec/
- add tests for hygienic macros
- remove some is($something, undef) instances, ack++
- moved most tests from examples/99problems to spec/integration/99problems*
and merged ten each into one file; solved problems 55, 57, 59.
- moved lexical_subs.t to spec/
- more tests for Unicode string lengths
- merge most of map_*.t into map.t
- moved a regex test to spec/, deleted a mostly wrong/pointless regex test
- moved oo construction and destruction tests to spec/
- moved all tests in oo/roles/ and oo/traits/ to spec/
- fudged pointy.t for rakudo
|
-
Property svn:mime-type set to
text/plain; charset=UTF-8
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | use v6; |
|---|
| 2 | |
|---|
| 3 | use Test; |
|---|
| 4 | |
|---|
| 5 | plan 4; |
|---|
| 6 | # L<A04/"RFC 022: Control flow: Builtin switch statement" /explicit C<\.id> method in any event/> |
|---|
| 7 | class Foo {} |
|---|
| 8 | |
|---|
| 9 | my $num_objects = 20; |
|---|
| 10 | |
|---|
| 11 | my %foos; |
|---|
| 12 | for (1 .. $num_objects) { |
|---|
| 13 | my $f = Foo.new(); |
|---|
| 14 | %foos{$f.WHICH()}++; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | is(+%foos, $num_objects, '... all our .WHICH()s were unique'); |
|---|
| 18 | |
|---|
| 19 | class Dog { |
|---|
| 20 | has Str $.dogtag is required; |
|---|
| 21 | has Num $.weight; |
|---|
| 22 | method WHICH { $.dogtag } |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | my Dog $spot .= new(:dogtag<SPOT01>, :weight<10.1>); |
|---|
| 26 | |
|---|
| 27 | # check that we can refer to a dog with its tag |
|---|
| 28 | #?pugs todo 'oo' |
|---|
| 29 | is(Dog.new(:dogtag<SPOT01>).weight, 10.1, |
|---|
| 30 | "WHICH is one basis for memoized instances"); |
|---|
| 31 | |
|---|
| 32 | # test singletons |
|---|
| 33 | class Boosh { |
|---|
| 34 | has $.name; |
|---|
| 35 | has @.cast is rw; |
|---|
| 36 | method BUILD { |
|---|
| 37 | $.name = "The Mighty"; |
|---|
| 38 | } |
|---|
| 39 | method WHICH { |
|---|
| 40 | $.name; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | my $foo = Boosh.new; |
|---|
| 45 | is($foo.WHICH, "The Mighty", "Which Boosh?"); |
|---|
| 46 | $foo.cast.push("Julian Barratt"); |
|---|
| 47 | $foo.cast.push("Noel Fielding"); |
|---|
| 48 | |
|---|
| 49 | #?pugs todo 'oo' |
|---|
| 50 | is_deeply(Boosh.new.cast, [ "Julian Barratt", "Noel Fielding" ], |
|---|
| 51 | "There is only one instance of $foo.WHICH $foo.WHAT"); |
|---|