diff options
author | Michael G. Schwern <schwern@pobox.com> | 2001-08-31 11:36:28 -0400 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-08-31 21:35:10 +0000 |
commit | 949d010fe77e69674beb14306cfc1b92afa3e47c (patch) | |
tree | 35893fdcbd7a0e2224d5815d66cbd02e83950de2 /t/run | |
parent | 06039172f345fd0b8aaa2a469ee190f34bf73239 (diff) | |
download | perl-949d010fe77e69674beb14306cfc1b92afa3e47c.tar.gz |
Re: [ID 20010831.001] SEGV from ($a, b) = (1, 2)
Message-ID: <20010831153628.B598@blackrider>
Check for things which used to segfault
p4raw-id: //depot/perl@11805
Diffstat (limited to 't/run')
-rw-r--r-- | t/run/segfault.t | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/t/run/segfault.t b/t/run/segfault.t new file mode 100644 index 0000000000..e3bd8b64be --- /dev/null +++ b/t/run/segfault.t @@ -0,0 +1,43 @@ +#!./perl +# +# Tests for things which have caused segfaults in the past. + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +# VMS and Windows need -e "...", most everything else works better with ' +my $quote = $^O =~ /^(VMS|MSWin\d+)$/ ? q{"} : q{'}; + +my $IsVMS = $^O eq 'VMS'; + + +BEGIN { + if( $^O =~ /^(VMS|MSWin\d+)$/ ) { + print "1..0 # Skipped: platform temporarily not supported\n"; + exit; + } +} + + +# Run some code, check that it has the expected output and exits +# with the code for a perl syntax error. +sub chk_segfault { + my($code, $expect, $name) = @_; + my $cmd = "$^X -e "; + + # I *think* these are the right exit codes for syntax error. + my $expected_exit = $IsVMS ? 4 : 255; + + my $out = `$cmd$quote$code$quote 2>&1`; + + is( $? >> 8, $expected_exit, "$name - exit as expected" ); + like( $out, qr/$expect at -e line 1/, ' with the right output' ); +} + +use Test::More tests => 2; + +chk_segfault('($a, b) = (1, 2)', + "Can't modify constant item in list assignment", + 'perlbug ID 20010831.001'); |