From 9977e560ffddf6c47e621610dfbb384d3c20aa56 Mon Sep 17 00:00:00 2001 From: LLFourn Date: Sun, 13 Dec 2015 14:22:27 +1100 Subject: [PATCH] Tests for RT #126880 also removed unnecessary EVAL around temp @array tests --- S04-blocks-and-statements/temp.t | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/S04-blocks-and-statements/temp.t b/S04-blocks-and-statements/temp.t index cfb7781b16..3602177eda 100755 --- a/S04-blocks-and-statements/temp.t +++ b/S04-blocks-and-statements/temp.t @@ -2,7 +2,7 @@ use v6; use Test; -plan 36; +plan 40; # L { @@ -53,17 +53,22 @@ plan 36; is $a, 42, "temp() restored the variable, the block was exited using an exception"; } -EVAL(' + { my @array = (0, 1, 2); { - temp @array[1] = 42; + temp @array[1] = 42; is @array[1], 42, "temp() changed our array element"; } - is @array[1], 1, "temp() restored our array element"; + is @array[1], 1, "temp() restored our array element"; + + { + temp @array[42] = 42; + } + #?rakudo 2 skip 'RT #126447' + ok not @array[42]:exists,"temp() removed previously non-exitent element"; + is @array.elems, 3, "temp() restored array has correct .elems"; } -"1 - delete this line when the parsefail EVAL() is removed"; -') or skip("parsefail: temp \@array[1]", 2); { my %hash = (:a(1), :b(2), :c(3)); @@ -72,6 +77,13 @@ EVAL(' is %hash, 42, "temp() changed our hash element"; } is %hash, 2, "temp() restored our array element"; + + { + temp %hash = 42; + } + #?rakudo 2 skip 'RT #126447' + ok not %hash:exists, "temp() removed previously non-existent key"; + is %hash.elems, 3, "temp() restored hash has correct .elems"; } {