diff options
Diffstat (limited to 't')
-rw-r--r--[-rwxr-xr-x] | t/op/filetest.t | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | t/op/subst_amp.t | 0 | ||||
-rw-r--r-- | t/pragma/warn/util | 47 |
3 files changed, 31 insertions, 16 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t index 66eaa3933d..66eaa3933d 100755..100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t diff --git a/t/op/subst_amp.t b/t/op/subst_amp.t index e2e7c0e542..e2e7c0e542 100755..100644 --- a/t/op/subst_amp.t +++ b/t/op/subst_amp.t diff --git a/t/pragma/warn/util b/t/pragma/warn/util index bd29f7b254..ea3aed5cca 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,56 @@ EXPECT Illegal binary digit '9' ignored at - line 3. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_bin { "1" x $_[0] } +$n = make_bin(8 * $Config{longsize} ) ; +$o = make_bin(8 * $Config{longsize} + 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 10. +Integer overflow in binary number at - line 14. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) } +$n = make_oct(8 * $Config{longsize} ); +$o = make_oct(8 * $Config{longsize} + 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 10. +Integer overflow in octal number at - line 14. ######## # util.c +BEGIN { require Config ; import Config } $^W =1 ; +sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) } +$n = make_hex(8 * $Config{longsize} ) ; +$o = make_hex(8 * $Config{longsize} + 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 10. +Integer overflow in hexadecimal number at - line 14. |