Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (103 sloc) 2.708 kb
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
1 use v6;
2
3 use Test;
4
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
5 plan 25;
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
6
4242675a » Auzon
2008-07-13 [gsoc_spectest] smartlink cleanups
7 # L<S09/Autovivification/In Perl 6 these read-only operations are indeed non-destructive:>
cdb6698b » coke
2013-08-28 pugs fudge
8 #?pugs todo
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
9 {
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
10 my %h;
11 my $b = %h<a><b>;
12 is %h.keys.elems, 0, "fetching doesn't autovivify.";
13 ok $b === Any, 'and the return value is not defined';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
14 }
15
a84fe9bd » coke
2012-04-10 pugs unfudge (so)
16 #?pugs skip ':exists'
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
17 {
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
18 my %h;
19 my $exists = %h<a><b>:exists;
20 is %h.keys.elems, 0, "exists doesn't autovivify.";
21 ok $exists === False, '... and it returns the right value';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
22 }
23
4242675a » Auzon
2008-07-13 [gsoc_spectest] smartlink cleanups
24 # L<S09/Autovivification/But these bindings do autovivify:>
99f26b60 » coke
2012-04-07 pugs fudge
25 #?pugs todo
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
26 {
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
27 my %h;
28 bar(%h<a><b>);
29 is %h.keys.elems, 0, "in ro arguments doesn't autovivify.";
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
30 }
31
32 {
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
33 my %h;
34 my $b := %h<a><b>;
cdb6698b » coke
2013-08-28 pugs fudge
35 #?pugs todo
6ef1b5d9 » coke
2013-09-01 niecza fudge
36 #?niecza todo "https://github.com/sorear/niecza/issues/176"
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
37 is %h.keys.elems, 0, 'binding does not immediately autovivify';
cdb6698b » coke
2013-08-28 pugs fudge
38 #?pugs todo
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
39 ok $b === Any, '... to an undefined value';
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
40 $b = 42;
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
41 is %h.keys.elems, 1, '.. but autovivifies after assignment';
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
42 is %h<a><b>, 42, 'having it in there';
cb5beb61 » lizmat
2013-08-26 Some more test passing now that we have Any.exists
43 ok %h<a><b> =:= $b, 'check binding';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
44 }
45
cdb6698b » coke
2013-08-28 pugs fudge
46 #?pugs todo
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
47 {
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
48 my %h;
49 my $b = \(%h<a><b>);
50 is %h.keys.elems, 0, 'capturing does not autovivify';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
51 }
52
53 {
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
54 my %h;
55 foo(%h<a><b>);
cdb6698b » coke
2013-08-28 pugs fudge
56 #?pugs todo
6ef1b5d9 » coke
2013-09-01 niecza fudge
57 #?niecza todo "https://github.com/sorear/niecza/issues/176"
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
58 is %h.keys.elems, 0, 'in rw arguments does not autovivify';
59 foo(%h<a><b>,42);
60 is %h.keys.elems, 1, 'storing from within the sub does autovivify';
61 is %h<a><b>, 42, 'got the right value';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
62 }
63
64 {
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
65 my %h;
66 %h<a><b> = 42;
67 is %h.keys.elems, 1, 'store autovivify.';
68 is %h<a><b>, 42, 'got the right value';
0ca4c116 » Auzon
2008-06-24 [gsoc_spectest] t/data_types/* -> t/spec/S02-builtin_data_types/
69 }
70
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
71 # helper subs
72 sub foo ($baz is rw, $assign? ) { $baz = $assign if $assign }
73 sub bar ($baz is readonly) { }
7f29bc53 » kyle
2009-08-08 [t/spec] Add vim: lines everywhere.
74
ef0e875a » moritz
2012-05-29 RT #77038, &push autovivifies its first argument
75 # RT #77038
26a959e7 » colomon
2012-05-29 Fudge for Niecza.
76 #?niecza skip "Unable to resolve method push in type Any"
ef0e875a » moritz
2012-05-29 RT #77038, &push autovivifies its first argument
77 {
78 my %h;
79 push %h<a>, 4, 2;
80 is %h<a>.join, '42', 'can autovivify in sub form of push';
0b03c96e » Jimmy Zhuo
2012-05-29 &unshift autovivifies its first argument
81 unshift %h<b>, 5, 3;
82 is %h<b>.join, '53', 'can autovivify in sub form of unshift';
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
83 %h<c><d>.push( 7, 8 );
84 is %h<c><d>.join, '78', 'can autovivify in method form of push';
85 %h<e><f>.unshift( 9, 10 );
86 is %h<e><f>.join, '910', 'can autovivify in method form of unshift';
87 is %h.keys.elems, 4, 'successfully autovivified lower level';
88 }
89
90 {
91 my $a;
92 $a[0] = '4';
93 $a[1] = '2';
94 is $a.join, '42', 'Can autovivify Array';
ef0e875a » moritz
2012-05-29 RT #77038, &push autovivifies its first argument
95 }
96
5436ea74 » moritz
2012-08-07 RT #77048, autovivification of Array-typed scalars
97 # RT #77048
98 {
99 my Array $a;
100 $a[0] = '4';
101 $a[1] = '2';
102 is $a.join, '42', 'Can autovivify Array-typed scalar';
103 }
104
478c26ae » lizmat
2013-08-27 Add some more auto-vivification tests
105 {
106 my $h;
107 $h<a> = '4';
108 $h<b> = '2';
109 is $h<a b>.join, '42', 'Can autovivify Hash';
110 }
111
112 {
113 my Hash $h;
114 $h<a> = '4';
115 $h<b> = '2';
116 is $h<a b>.join, '42', 'Can autovivify Hash-typed scalar';
117 }
118
119
7f29bc53 » kyle
2009-08-08 [t/spec] Add vim: lines everywhere.
120 # vim: ft=perl6
Something went wrong with that request. Please try again.