From 3957fed2677fb0bbb16007cfc9b88acf82b8b2ef Mon Sep 17 00:00:00 2001 From: usev6 Date: Sun, 5 Jul 2015 09:19:34 +0200 Subject: [PATCH] Add tests for RT #115390 --- S14-roles/mixin.t | 14 +++++++++++++- S29-os/system.t | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/S14-roles/mixin.t b/S14-roles/mixin.t index a568d591fa..8f6ca1ad44 100644 --- a/S14-roles/mixin.t +++ b/S14-roles/mixin.t @@ -1,6 +1,6 @@ use v6; use Test; -plan 36; +plan 37; # L @@ -125,6 +125,18 @@ is $y.test, 42, 'method from other role was OK too'; is ?$a, Bool::True, 'RT #100782 2/2'; } +# RT 115390 +{ + my $rt115390 = 0; + for 1..1000 -> $i { + $rt115390 += $i.perl; + my $error = (my $val = (^10).pick(3).min but !$val); + 1 + } + is $rt115390, 500500, + 'no crash with mixin in loop when it is not the last statement in loop'; +} + # RT #79866 { my $x = 42 but role { method postcircumfix:<( )>($arg) { self * $arg[0] } }; diff --git a/S29-os/system.t b/S29-os/system.t index 06663dcdd4..e890c9adc9 100644 --- a/S29-os/system.t +++ b/S29-os/system.t @@ -4,7 +4,7 @@ use Test; # L # system is renamed to run, so link there. -plan 6; +plan 8; my $res; @@ -30,6 +30,24 @@ ok(!$res, "run() to a nonexisting program with an argument list does not die (an 'qx{} does not capture stderr'; } +# RT #115390 +{ + my $rt115390; + for 1..100 -> $i { + $rt115390 += $i.perl; + run "true"; + 1; + } + is $rt115390, 5050, 'no crash with run() in loop; run() in sink context'; + $rt115390 = 0; + for 1..100 -> $i { + $rt115390 += $i.perl; + my $var = run "true"; + 1; + } + is $rt115390, 5050, 'no crash with run() in loop; run() not in sink context'; +} + # all these tests feel like bogus, what are we testing here??? chdir "t"; my $cwd;