Skip to content

Commit 4dcb14e

Browse files
committed
Revert "Generic fudge for jvm NPEs"
This reverts commit b0cf420. Tests are passing again after rakudo commit 5da0b3f.
1 parent 5e1c8c7 commit 4dcb14e

File tree

4 files changed

+2
-96
lines changed

4 files changed

+2
-96
lines changed

S02-types/bag.t

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ sub showkv($x) {
1212
{
1313
my $b = bag <a foo a a a a b foo>;
1414
isa-ok $b, Bag, '&bag produces a Bag';
15-
#?rakudo.jvm skip 'NPE'
1615
is showkv($b), 'a:5 b:1 foo:2', '...with the right elements';
1716

1817
is $b.default, 0, "Defaults to 0";
@@ -32,7 +31,6 @@ sub showkv($x) {
3231
lives-ok { $hash = $b.hash },
3332
".hash doesn't die";
3433
isa-ok $hash, Hash, "...and it returned a Hash";
35-
#?rakudo.jvm skip 'NPE'
3634
is showkv($hash), 'a:5 b:1 foo:2', '...with the right elements';
3735

3836
throws-like { $b<a> = 5 },
@@ -72,25 +70,18 @@ sub showkv($x) {
7270

7371
{
7472
isa-ok "a".Bag, Bag, "Str.Bag makes a Bag";
75-
#?rakudo.jvm skip 'NPE'
7673
is showkv("a".Bag), 'a:1', "'a'.Bag is bag a";
7774

7875
isa-ok (a => 100000).Bag, Bag, "Pair.Bag makes a Bag";
79-
#?rakudo.jvm skip 'NPE'
8076
is showkv((a => 100000).Bag), 'a:100000', "(a => 100000).Bag is bag a:100000";
81-
#?rakudo.jvm skip 'NPE'
8277
is showkv((a => 0).Bag), '', "(a => 0).Bag is the empty bag";
8378

8479
isa-ok <a b c>.Bag, Bag, "<a b c>.Bag makes a Bag";
85-
#?rakudo.jvm skip 'NPE'
8680
is showkv(<a b c a>.Bag), 'a:2 b:1 c:1', "<a b c a>.Bag makes the bag a:2 b:1 c:1";
87-
#?rakudo.jvm skip 'NPE'
8881
is showkv(["a", "b", "c", "a"].Bag), 'a:2 b:1 c:1', "[a b c a].Bag makes the bag a:2 b:1 c:1";
89-
#?rakudo.jvm skip 'NPE'
9082
is showkv([a => 3, b => 0, 'c', 'a'].Bag), 'a:4 c:1', "[a => 3, b => 0, 'c', 'a'].Bag makes the bag a:4 c:1";
9183

9284
isa-ok {a => 2, b => 4, c => 0}.Bag, Bag, "{a => 2, b => 4, c => 0}.Bag makes a Bag";
93-
#?rakudo.jvm skip 'NPE'
9485
is showkv({a => 2, b => 4, c => 0}.Bag), 'a:2 b:4', "{a => 2, b => 4, c => 0}.Bag makes the bag a:2 b:4";
9586
}
9687

@@ -123,14 +114,12 @@ sub showkv($x) {
123114
{
124115
my %h := bag <a b o p a p o o>;
125116
ok %h ~~ Bag, 'A hash to which a Bag has been bound becomes a Bag';
126-
#?rakudo.jvm skip 'NPE'
127117
is showkv(%h), 'a:2 b:1 o:3 p:2', '...with the right elements';
128118
}
129119

130120
{
131121
my $b = bag <a b o p a p o o>;
132122
isa-ok $b, Bag, '&Bag.new given an array of strings produces a Bag';
133-
#?rakudo.jvm skip 'NPE'
134123
is showkv($b), 'a:2 b:1 o:3 p:2', '...with the right elements';
135124
}
136125

@@ -166,7 +155,6 @@ sub showkv($x) {
166155
is +$b, 1, "... with one element";
167156
}
168157

169-
#?rakudo.jvm skip 'NPE'
170158
{
171159
my $b = bag set <foo bar foo bar baz foo>;
172160
isa-ok $b, Bag, '&Bag.new given a Set produces a Bag';
@@ -181,14 +169,12 @@ sub showkv($x) {
181169
}
182170

183171
#?niecza skip 'BagHash'
184-
#?rakudo.jvm skip 'NPE'
185172
{
186173
my $b = bag BagHash.new(<foo bar foo bar baz foo>);
187174
isa-ok $b, Bag, '&Bag.new given a BagHash produces a Bag';
188175
is +$b, 1, "... with one element";
189176
}
190177

191-
#?rakudo.jvm skip 'NPE'
192178
{
193179
my $b = bag set <foo bar foo bar baz foo>;
194180
isa-ok $b, Bag, '&bag given a Set produces a Bag';
@@ -200,7 +186,6 @@ sub showkv($x) {
200186
{
201187
my %b := bag <a b c b>;
202188
isa-ok %b, Bag, 'A Bag bound to a %var is a Bag';
203-
#?rakudo.jvm skip 'NPE'
204189
is showkv(%b), 'a:1 b:2 c:1', '...with the right elements';
205190

206191
is %b<b>, 2, 'Single-key subscript (existing element)';
@@ -243,7 +228,6 @@ sub showkv($x) {
243228
lives-ok { $c = EVAL $s },
244229
".perl.EVAL lives";
245230
isa-ok $c, Bag, "... and produces a Bag";
246-
#?rakudo.jvm skip 'NPE'
247231
is showkv($c), showkv($b), "... and it has the correct values";
248232
}
249233

@@ -253,7 +237,6 @@ sub showkv($x) {
253237
lives-ok { $s = $b.Str },
254238
".Str lives";
255239
isa-ok $s, Str, "... and produces a string";
256-
#?rakudo.jvm skip 'NPE'
257240
is $s.split(" ").sort.join(" "), "bar(3) baz foo(2)", "... which only contains bar baz and foo with the proper counts and separated by spaces";
258241
}
259242

@@ -274,7 +257,6 @@ sub showkv($x) {
274257
{
275258
my %b := bag "a", "b", "c", "b";
276259
isa-ok %b, Bag, 'A Bag bound to a %var is a Bag';
277-
#?rakudo.jvm skip 'NPE'
278260
is showkv(%b), 'a:1 b:2 c:1', '...with the right elements';
279261

280262
is %b<b>, 2, 'Single-key subscript (existing element)';
@@ -393,7 +375,6 @@ sub showkv($x) {
393375
'cannot call .grabpairs on a Bag';
394376
}
395377

396-
#?rakudo.jvm skip 'NPE'
397378
{
398379
my $b1 = Bag.new( (bag <a b c>) , <c c c d d d d>);
399380
is +$b1, 2, "Two elements";
@@ -419,21 +400,16 @@ sub showkv($x) {
419400

420401
{
421402
isa-ok 42.Bag, Bag, "Method .Bag works on Int-1";
422-
#?rakudo.jvm skip 'NPE'
423403
is showkv(42.Bag), "42:1", "Method .Bag works on Int-2";
424404
isa-ok "blue".Bag, Bag, "Method .Bag works on Str-1";
425-
#?rakudo.jvm skip 'NPE'
426405
is showkv("blue".Bag), "blue:1", "Method .Bag works on Str-2";
427406
my @a = <Now the cross-handed set was the Paradise way>;
428407
isa-ok @a.Bag, Bag, "Method .Bag works on Array-1";
429-
#?rakudo.jvm skip 'NPE'
430408
is showkv(@a.Bag), "Now:1 Paradise:1 cross-handed:1 set:1 the:2 was:1 way:1", "Method .Bag works on Array-2";
431409
my %x = "a" => 1, "b" => 2;
432410
isa-ok %x.Bag, Bag, "Method .Bag works on Hash-1";
433-
#?rakudo.jvm skip 'NPE'
434411
is showkv(%x.Bag), "a:1 b:2", "Method .Bag works on Hash-2";
435412
isa-ok (@a, %x).Bag, Bag, "Method .Bag works on List-1";
436-
#?rakudo.jvm skip 'NPE'
437413
is showkv((@a, %x).Bag), "Now:1 Paradise:1 a:1 b:2 cross-handed:1 set:1 the:2 was:1 way:1",
438414
"Method .Bag works on List-2";
439415
}
@@ -446,7 +422,6 @@ sub showkv($x) {
446422
is $b1.minpairs, [a=>1], '.minpairs works (non-empty 10)';
447423
is $b1.maxpairs, [d=>4], '.maxpairs works (non-empty 10)';
448424
# Bag is unordered according to S02:1476
449-
#?rakudo.jvm 4 skip 'NPE'
450425
is $b1.fmt('foo %s').split("\n").sort, ('foo a', 'foo b', 'foo c', 'foo d'),
451426
'.fmt(%s) works (non-empty 10)';
452427
is $b1.fmt('%s',',').split(',').sort, <a b c d>,
@@ -459,21 +434,18 @@ sub showkv($x) {
459434
my $b2 = <a b c c c d d d>.Bag;
460435
is $b2.total, 8, '.total gives sum of values (non-empty 8)';
461436
is +$b2, 8, '+$bag gives sum of values (non-empty 8)';
462-
#?rakudo.jvm 2 skip 'NPE'
463437
is $b2.minpairs.sort, [a=>1, b=>1], '.minpairs works (non-empty 8)';
464438
is $b2.maxpairs.sort, [c=>3, d=>3], '.maxpairs works (non-empty 8)';
465439

466440
$b2 = <a b c d>.Bag;
467441
is $b2.total, 4, '.total gives sum of values (non-empty 4)';
468442
is +$b2, 4, '+$bag gives sum of values (non-empty 4)';
469-
#?rakudo.jvm 2 skip 'NPE'
470443
is $b2.minpairs.sort,[a=>1,b=>1,c=>1,d=>1], '.minpairs works (non-empty 4)';
471444
is $b2.maxpairs.sort,[a=>1,b=>1,c=>1,d=>1], '.maxpairs works (non-empty 4)';
472445

473446
my $e = ().Bag;
474447
is $e.total, 0, '.total gives sum of values (empty)';
475448
is +$e, 0, '+$bag gives sum of values (empty)';
476-
#?rakudo.jvm 6 skip 'NPE'
477449
is $e.minpairs, (), '.minpairs works (empty)';
478450
is $e.maxpairs, (), '.maxpairs works (empty)';
479451
is $e.fmt('foo %s'), "", '.fmt(%s) works (empty)';
@@ -482,15 +454,13 @@ sub showkv($x) {
482454
is $e.fmt('%s,%s',':'), "", '.fmt(%s%s,sep) works (empty)';
483455
}
484456

485-
#?rakudo.moar todo 'we have not secured .WHICH creation yet RT #124454'
486-
#?rakudo.jvm skip 'NPE'
457+
#?rakudo todo 'we have not secured .WHICH creation yet RT #124454'
487458
{
488459
isnt 'a(1) Str|b(1) Str|c'.Bag.WHICH, <a b c>.Bag.WHICH,
489460
'Faulty .WHICH creation';
490461
}
491462

492463
# RT #117915
493-
#?rakudo.jvm skip 'NPE'
494464
{
495465
my @pairings;
496466
my Bag $bag .= new: <foo foo bar>;
@@ -508,7 +478,6 @@ sub showkv($x) {
508478
my class MyBag is Bag { }
509479
my $b = MyBag.new(|<a foo a a a a b foo>);
510480
isa-ok $b, MyBag, 'MyBag.new produces a MyBag';
511-
#?rakudo.jvm skip 'NPE'
512481
is showkv($b), 'a:5 b:1 foo:2', '...with the right elements';
513482
}
514483

@@ -531,7 +500,6 @@ sub showkv($x) {
531500
'Make sure we cannot assign on a .kv alias';
532501
}
533502

534-
#?rakudo.jvm skip 'NPE'
535503
{
536504
my $b = <a b b c c c d d d d>.Bag;
537505
my @a1;

0 commit comments

Comments
 (0)