From e3fdf9887934783dd5692982e11c048eb7c97265 Mon Sep 17 00:00:00 2001 From: Gisle Aas Date: Fri, 16 Oct 1998 18:33:12 +0200 Subject: disallow 'x' in hex numbers (except leading '0x') Message-ID: Subject: Re: [PATCH 5.005_52] 'x' is not a legal hex digit p4raw-id: //depot/perl@2054 --- t/op/oct.t | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/op/oct.t b/t/op/oct.t index 24b5c4309d..66230898ab 100755 --- a/t/op/oct.t +++ b/t/op/oct.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: oct.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:08 $ - -print "1..8\n"; +print "1..9\n"; print +(oct('01234') == 01234) ? "ok" : "not ok", " 1\n"; print +(oct('0x1234') == 0x1234) ? "ok" : "not ok", " 2\n"; @@ -12,3 +10,4 @@ print +(oct('x80000000') == 0x80000000) ? "ok" : "not ok", " 5\n"; print +(hex('80000000') == 0x80000000) ? "ok" : "not ok", " 6\n"; print +(oct('1234') == 668) ? "ok" : "not ok", " 7\n"; print +(hex('1234') == 4660) ? "ok" : "not ok", " 8\n"; +print +(hex('0x1234') == 0x1234) ? "ok" : "not ok", " 9\n"; -- cgit v1.2.1 From 2158dd9ba94672764f0bb8563ece1a0573db179b Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 25 Oct 1998 05:40:40 +0000 Subject: integrate change#2053 from maint-5.005 p4raw-link: @2053 on //depot/maint-5.005/perl: 2c3f7d309175811e431d5baa7695e7610e2fa584 p4raw-id: //depot/perl@2057 p4raw-integrated: from //depot/maint-5.005/perl@2056 'copy in' t/cmd/while.t (@1649..) 'merge in' cop.h (@1649..) --- t/cmd/while.t | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/cmd/while.t b/t/cmd/while.t index c6e464d444..392c13779f 100755 --- a/t/cmd/while.t +++ b/t/cmd/while.t @@ -2,7 +2,7 @@ # $RCSfile: while.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:15 $ -print "1..10\n"; +print "1..15\n"; open (tmp,'>Cmd_while.tmp') || die "Can't create Cmd_while.tmp."; print tmp "tvi925\n"; @@ -109,3 +109,22 @@ $i = 9; $i++; } print "ok $i\n"; + +# Check curpm is reset when jumping out of a scope +'abc' =~ /b/; +WHILE: +while (1) { + $i++; + print "#$`,$&,$',\nnot " unless $` . $& . $' eq "abc"; + print "ok $i\n"; + { # Localize changes to $` and friends + 'end' =~ /end/; + redo WHILE if $i == 11; + next WHILE if $i == 12; + # 13 do a normal loop + last WHILE if $i == 14; + } +} +$i++; +print "not " unless $` . $& . $' eq "abc"; +print "ok $i\n"; -- cgit v1.2.1 From 33c2748902d07b7ec367f87ad66e61e89f2aa994 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 25 Oct 1998 06:33:43 +0000 Subject: integrate changes#1982,2014,2021 (from maint-5.005) p4raw-link: @2021 on //depot/maint-5.005/perl: ece095e7b265a16d4ec3543b1418100f9c635a87 p4raw-link: @2014 on //depot/maint-5.005/perl: cca0b9804acab4b7678c0f185888d57497a5c2a9 p4raw-link: @1982 on //depot/maint-5.005/perl: fe676099d996f70caaedeb6ae85adc3ee59d2240 p4raw-id: //depot/perl@2059 --- t/op/tie.t | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') diff --git a/t/op/tie.t b/t/op/tie.t index f1b12d6d81..451dee07b3 100755 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -153,3 +153,16 @@ $C = $B = tied %H ; } untie %H; EXPECT +######## + +# verify no leak when underlying object is selfsame tied variable +my ($a, $b); +sub Self::TIEHASH { bless $_[1], $_[0] } +sub Self::DESTROY { $b = $_[0] + 0; } +{ + my %b5; + $a = \%b5 + 0; + tie %b5, 'Self', \%b5; +} +die unless $a == $b; +EXPECT -- cgit v1.2.1 From ce9935e078582f01b05cad6db77c0a8312bee15b Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Mon, 26 Oct 1998 00:50:02 +0000 Subject: sanity-check $Config{drand01} in rand.t p4raw-id: //depot/perl@2085 --- t/op/rand.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/op/rand.t b/t/op/rand.t index a68559ff79..2f02d344fc 100755 --- a/t/op/rand.t +++ b/t/op/rand.t @@ -52,6 +52,17 @@ sub bits ($) { $max = $min = rand(1); for (1..$reps) { my $n = rand(1); + if ($n < 0.0 or $n >= 1.0) { + print <= 1.0. +# Make sure \$Config{drand01} is a valid expression in the +# C-language, and produces values in the range [0.0,1.0). +# +# I give up. +EOM + exit; + } $sum += $n; $bits += bits($n * 256); # Don't be greedy; 8 is enough # It's too many if randbits is less than 8! @@ -75,7 +86,7 @@ sub bits ($) { # wrong value is that Config.pm is incorrect.) # if ($max <= 0 or $max >= (2 ** $randbits)) {# Just in case... - print "not ok 1\n"; + print "# max=[$max] min=[$min]\nnot ok 1\n"; print "# This perl was compiled with randbits=$randbits\n"; print "# which is _way_ off. Or maybe your system rand is broken,\n"; print "# or your C compiler can't multiply, or maybe Martians\n"; @@ -91,7 +102,7 @@ sub bits ($) { $off = int($off) + ($off > 0); # Next more positive int if ($off) { $shouldbe = $Config{randbits} + $off; - print "not ok 1\n"; + print "# max=[$max] min=[$min]\nnot ok 1\n"; print "# This perl was compiled with randbits=$randbits on $^O.\n"; print "# Consider using randbits=$shouldbe instead.\n"; # And skip the remaining tests; they would be pointless now. -- cgit v1.2.1