- Timestamp:
- 11/08/08 08:28:41 (2 months ago)
- Location:
- t/spec
- Files:
-
- 7 modified
-
S02-builtin_data_types/catch_type_cast_mismatch.t (modified) (2 diffs)
-
S02-builtin_data_types/mixed_multi_dimensional.t (modified) (9 diffs)
-
S03-operators/assign-is-not-binding.t (modified) (1 diff)
-
S03-operators/chained-declarators.t (modified) (1 diff)
-
S03-operators/precedence.t (modified) (1 diff)
-
S06-traits/misc.t (modified) (4 diffs)
-
S11-modules/import.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S02-builtin_data_types/catch_type_cast_mismatch.t
r22409 r22919 41 41 lives_ok { $x = {a => 1} }, 'Can assign an hashref to a scalar'; 42 42 my $y = { b => 34 }; 43 #?rakudo todo 'RT #59382'44 43 lives_ok { $y = 3 }, 'Can assign a number to scalar with an hashref'; 45 44 } … … 50 49 lives_ok { $x = { a => 3 } }, 'can assign hashref to scalar that held an array ref'; 51 50 my $y = { df => 'dfd', 'ui' => 3 }; 52 #?rakudo todo 'RT #59382'53 51 lives_ok { $y = [0, 7] }, 'can assign arrayref to scalar that held an hashref'; 54 52 -
t/spec/S02-builtin_data_types/mixed_multi_dimensional.t
r22855 r22919 12 12 These tests don't go any more than two levels deep 13 13 (AoH, AoP) in most cases because I know these won't 14 work yet in Pugs. When we have this support, then 14 work yet in Pugs. When we have this support, then 15 15 this test should be added too more. 16 16 … … 22 22 my @array; 23 23 isa_ok(@array, Array); 24 24 25 25 my $pair = ('key' => 'value'); 26 26 isa_ok($pair, Pair); 27 27 28 28 @array[0] = $pair; # assign a variable 29 29 is(+@array, 1, 'the array has one value in it'); 30 30 31 31 isa_ok(@array[0], Pair); 32 32 #?rakudo skip "get_pmc_keyed() not implemented in class 'Perl6Pair'" … … 44 44 my @array; 45 45 isa_ok(@array, Array); 46 46 47 47 my %hash = ('key', 'value', 'key1', 'value1'); 48 48 isa_ok(%hash, Hash); 49 49 is(+%hash.keys, 2, 'our hash has two keys'); 50 50 51 51 @array[0] = %hash; 52 52 is(+@array, 1, 'the array has one value in it'); 53 53 isa_ok(@array[0], Hash); 54 54 is(@array[0]{"key"}, 'value', 'got the right value for key'); 55 is(@array[0]<key1>, 'value1', 'got the right value1 for key1'); 55 is(@array[0]<key1>, 'value1', 'got the right value1 for key1'); 56 56 } 57 57 … … 59 59 my @array = (1, [2, 3], [4, 5], 6); 60 60 isa_ok(@array, Array); 61 61 62 62 is(+@array, 4, 'got 4 elements in the Array of Arrays'); 63 63 is(@array[0], 1, 'got the right first element'); 64 64 #?rakudo todo 'too eager list flattening' 65 65 isa_ok(@array[1], 'Array'); 66 is(@array[1][0], 2, 'got the right second/first element'); 67 is(@array[1][1], 3, 'got the right second/second element'); 68 isa_ok(@array[2], Array); 69 is(@array[2][0], 4, 'got the right third/first element'); 70 is(@array[2][1], 5, 'got the right third/second element'); 66 is(@array[1][0], 2, 'got the right second/first element'); 67 is(@array[1][1], 3, 'got the right second/second element'); 68 isa_ok(@array[2], Array); 69 is(@array[2][0], 4, 'got the right third/first element'); 70 is(@array[2][1], 5, 'got the right third/second element'); 71 71 is(@array[3], 6, 'got the right fourth element'); 72 72 } … … 75 75 my @array; 76 76 isa_ok(@array, Array); 77 77 78 78 @array[0] = sub { 1 }; 79 79 @array[1] = { 2 }; 80 80 #?rakudo emit # 81 81 @array[2] = -> { 3 }; 82 82 83 83 #?rakudo todo 'test dependency' 84 84 is(+@array, 3, 'got three elements in the Array'); … … 87 87 isa_ok(@array[1], Block); 88 88 #?rakudo todo 'test dependency' 89 isa_ok(@array[2], Block); 90 89 isa_ok(@array[2], Block); 90 91 91 is(@array[0](), 1, 'the first element (when executed) is 1'); 92 is(@array[1](), 2, 'the second element (when executed) is 2'); 92 is(@array[1](), 2, 'the second element (when executed) is 2'); 93 93 #?rakudo skip 'test dependency (pointy blocks)' 94 94 is(@array[2](), 3, 'the third element (when executed) is 3'); … … 98 98 my %hash; 99 99 isa_ok(%hash, 'Hash'); 100 100 101 101 %hash<key> = [ 1, 2, 3 ]; 102 102 isa_ok(%hash<key>, Array); 103 104 is(+%hash<key>, 3, 'it should have 3 values in it'); 103 104 is(+%hash<key>, 3, 'it should have 3 values in it'); 105 105 is(%hash<key>[0], 1, 'got the right value'); 106 is(%hash<key>[1], 2, 'got the right value'); 106 is(%hash<key>[1], 2, 'got the right value'); 107 107 is(%hash<key>[2], 3, 'got the right value'); 108 108 109 109 { 110 110 my $array = %hash<key>; 111 is(+$array, 3, 'it should have 3 values in it'); 111 is(+$array, 3, 'it should have 3 values in it'); 112 112 is($array[0], 1, 'got the right value (when I pull the array out)'); 113 is($array[1], 2, 'got the right value (when I pull the array out)'); 114 is($array[2], 3, 'got the right value (when I pull the array out)'); 113 is($array[1], 2, 'got the right value (when I pull the array out)'); 114 is($array[2], 3, 'got the right value (when I pull the array out)'); 115 115 } 116 116 117 { 117 { 118 118 %hash<key>.push(4); 119 119 is(+%hash<key>, 4, 'it should now have 4 values in it'); 120 is(%hash<key>[3], 4, 'got the right value (which we just pushed onto the list)'); 120 is(%hash<key>[3], 4, 'got the right value (which we just pushed onto the list)'); 121 121 } 122 122 … … 127 127 my %hash; 128 128 isa_ok(%hash, Hash); 129 129 130 130 my @array = ( 1, 2, 3 ); 131 131 isa_ok(@array, Array); 132 132 133 133 %hash<key> = @array; 134 134 isa_ok(%hash<key>, Array); 135 136 is(+%hash<key>, 3, 'it should have 3 values in it'); 135 136 is(+%hash<key>, 3, 'it should have 3 values in it'); 137 137 is(%hash<key>[0], 1, 'got the right value'); 138 is(%hash<key>[1], 2, 'got the right value'); 138 is(%hash<key>[1], 2, 'got the right value'); 139 139 is(%hash<key>[2], 3, 'got the right value'); 140 140 141 141 { 142 142 #?rakudo emit # 143 143 my @array = @( %hash<key> ); 144 144 #?rakudo 4 skip 'test dependency HoA' 145 is(+@array, 3, 'it should have 3 values in it'); 145 is(+@array, 3, 'it should have 3 values in it'); 146 146 is(@array[0], 1, 'got the right value (when I pull the array out)'); 147 is(@array[1], 2, 'got the right value (when I pull the array out)'); 148 is(@array[2], 3, 'got the right value (when I pull the array out)'); 147 is(@array[1], 2, 'got the right value (when I pull the array out)'); 148 is(@array[2], 3, 'got the right value (when I pull the array out)'); 149 149 } 150 150 151 #?rakudo skip "Method 'push' not found" 152 { 151 { 153 152 %hash<key>.push(4); 154 153 155 154 is(+%hash<key>, 4, 'it should now have 4 values in it'); 156 is(%hash<key>[3], 4, 'got the right value (which we just pushed onto the array)'); 155 is(%hash<key>[3], 4, 'got the right value (which we just pushed onto the array)'); 157 156 } 158 157 … … 203 202 is(+@array[1]<two>[0], 2, "two keys at level 4"); 204 203 is(@array[1]<two>[0]<f><other>, 5, "more keys at level 4"); 205 } 204 } 206 205 207 206 # vim: ft=perl6 -
t/spec/S03-operators/assign-is-not-binding.t
r20966 r22919 34 34 is $temp, 23, 'Could retrieve first element to a scalar'; 35 35 @array[0] = @array[1]; 36 #?rakudo todo "BUG: assignment from array element to scalar creates a binding"37 36 is $temp, 23, "Assignment to scalar didn't create a binding" 38 37 } -
t/spec/S03-operators/chained-declarators.t
r22326 r22919 13 13 # we take care to use different names to avoid other *kinds* of insanity. 14 14 15 #?rakudo 2 todo 'chained my, our (and scalar autovivification)'16 15 is((try { my $a1 = my $b1 = 42; $b1++; "$a1, $b1" }), '42, 43', "chained my"); 17 16 is((try { my $a2 = our $b2 = 42; $b2++; "$a2, $b2" }), '42, 43', "chained my, our"); -
t/spec/S03-operators/precedence.t
r22413 r22919 68 68 69 69 ok( ?( (1 & 2 | 3) !=3), '& binds tighter than |'); 70 #?rakudo skip "Negate a junction (???)"71 70 ok((!(1 & 2 | 3) < 2), "ditto"); 72 71 ok(?((1 & 2 ^ 3) < 3), "and also ^"); -
t/spec/S06-traits/misc.t
r22903 r22919 16 16 17 17 # note: many of these errors can be detected at compile time, so need 18 # eval_dies_ok instead of dies_ok 18 # eval_dies_ok instead of dies_ok 19 19 # 20 20 # test twice, once with assignment and once with increment, rakudo … … 28 28 ', 29 29 'can\'t modify parameter, constant by default'; 30 30 31 31 eval_dies_ok ' 32 32 my $tmp = 1; … … 37 37 38 38 # is readonly 39 eval_dies_ok 'sub mods_param_constant ($x is readonly) { $x++; }; 40 mods_param_constant($foo);' , 39 eval_dies_ok 'sub mods_param_constant ($x is readonly) { $x++; }; 40 mods_param_constant($foo);' , 41 41 'can\'t modify constant parameter, constant by default'; 42 42 … … 54 54 sub mods_param_copy ($x is copy) {$x++;} 55 55 lives_ok { mods_param_copy($foo) }, 'is copy'; 56 #?rakudo todo 'is copy'57 56 is($foo, 1, 'pass by value works'); 58 57 -
t/spec/S11-modules/import.t
r22625 r22919 2 2 use Test; 3 3 4 plan 3;4 plan 4; 5 5 6 6 # L<S11/"Compile-time Importation"/> … … 9 9 use t::spec::packages::S11-modules::Foo; 10 10 11 ok( &t::spec::packages::S11-modules::Foo::foo, 'Foo::foo is defined' ); 11 12 ok( &foo, 'Foo::foo is defined' ); 12 13 is( foo(), 'Foo::foo', 'Foo::foo is the sub we expect' );
