diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-19 00:42:34 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-19 00:42:34 +0000 |
commit | 99aa7cfad52a98bd1b8c42cf718771ddb0d14509 (patch) | |
tree | 4a99834a0f01de6d264f0811b656ed3538c7ca33 /t | |
parent | 2ce77adffcc4a54956eaa524ddf0afc1210b30b2 (diff) | |
parent | 0faf3e6502ba533234322c904a3fa6b70b610627 (diff) | |
download | perl-99aa7cfad52a98bd1b8c42cf718771ddb0d14509.tar.gz |
integrate cfgperl contents into mainline
p4raw-id: //depot/perl@3700
Diffstat (limited to 't')
-rw-r--r-- | t/pragma/warn/util | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/t/pragma/warn/util b/t/pragma/warn/util index bd29f7b254..fc1e6dde3f 100644 --- a/t/pragma/warn/util +++ b/t/pragma/warn/util @@ -31,7 +31,7 @@ use warning 'unsafe' ; no warning 'unsafe' ; *a = hex "0xv9" ; EXPECT -Illegal hex digit 'v' ignored at - line 3. +Illegal hexadecimal digit 'v' ignored at - line 3. ######## # util.c use warning 'unsafe' ; @@ -42,41 +42,62 @@ EXPECT Illegal binary digit '9' ignored at - line 3. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_bin { "1" x $_[0] } +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_bin(8 * $s ) ; +$o = make_bin(8 * $s + 1) ; { use warning 'unsafe' ; - my $a = oct "0b111111111111111111111111111111111" ; + my $a = oct "0b$n" ; + my $b = oct "0b$o" ; no warning 'unsafe' ; - $a = oct "0b111111111111111111111111111111111" ; + $b = oct "0b$o" ; } -my $a = oct "0b111111111111111111111111111111111" ; +my $b = oct "0b$o" ; EXPECT -Integer overflow in binary number at - line 5. -Integer overflow in binary number at - line 9. +Integer overflow in binary number at - line 12. +Integer overflow in binary number at - line 16. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) } +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_oct(8 * $s ); +$o = make_oct(8 * $s + 1); { use warning 'unsafe' ; - my $a = oct "777777777777777777777777777777777777" ; + my $a = oct "$n" ; + my $b = oct "$o" ; no warning 'unsafe' ; - $a = oct "777777777777777777777777777777777777" ; + $b = oct "$o" ; } -my $a = oct "777777777777777777777777777777777777" ; +my $b = oct "$o" ; EXPECT -Integer overflow in octal number at - line 5. -Integer overflow in octal number at - line 9. +Integer overflow in octal number at - line 12. +Integer overflow in octal number at - line 16. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) } +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_hex(8 * $s ) ; +$o = make_hex(8 * $s + 1) ; { use warning 'unsafe' ; - my $a = hex "ffffffffffffffffffffffffffffffff" ; + my $a = hex "$n" ; + my $b = hex "$o" ; no warning 'unsafe' ; - $a = hex "ffffffffffffffffffffffffffffffff" ; + $b = hex "$o" ; } -my $a = hex "ffffffffffffffffffffffffffffffff" ; +my $b = hex "$o" ; EXPECT -Integer overflow in hex number at - line 5. -Integer overflow in hex number at - line 9. +Integer overflow in hexadecimal number at - line 12. +Integer overflow in hexadecimal number at - line 16. |