diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-11-22 20:49:12 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-11-22 20:49:12 +0000 |
commit | f15b33d337d48f26112cfef23a2f05290f7ec3ae (patch) | |
tree | 06a4016beddb3cae766e1b066bc645175375c179 | |
parent | 923be969f850682dfbedb80d41b470ed27a2362b (diff) | |
download | perl-f15b33d337d48f26112cfef23a2f05290f7ec3ae.tar.gz |
Move some tests from t/run/fresh_perl.t
to the new t/comp/parser.t. The goal being to
get rid of fresh_perl.t at some point.
p4raw-id: //depot/perl@18170
-rw-r--r-- | t/comp/parser.t | 38 | ||||
-rw-r--r-- | t/run/fresh_perl.t | 55 |
2 files changed, 37 insertions, 56 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t index 26f9c4e56c..dc8325607d 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -8,8 +8,42 @@ BEGIN { @INC = '../lib'; } -print "1..1\n"; +require "./test.pl"; +plan( tests => 9 ); + +eval '%@x=0;'; +like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); + +# Bug 20010422.005 +eval q{{s//${}/; //}}; +like( $@, qr/syntax error/, 'syntax error, used to dump core' ); + +# Bug 20010528.007 +eval q/"\x{"/; +like( $@, qr/^Missing right brace on \\x/, + 'syntax error in string, used to dump core' ); + +eval "a.b.c.d.e.f;sub"; +like( $@, qr/^Illegal declaration of anonymous subroutine/, + 'found by Markov chain stress testing' ); + +# Bug 20010831.001 +eval '($a, b) = (1, 2);'; +like( $@, qr/^Can't modify constant item in list assignment/, + 'bareword in list assignment' ); + +eval 'tie FOO, "Foo";'; +like( $@, qr/^Can't modify constant item in tie /, + 'tying a bareword causes a segfault in 5.6.1' ); + +eval 'undef foo'; +like( $@, qr/^Can't modify constant item in undef operator /, + 'undefing constant causes a segfault in 5.6.1 [ID 20010906.019]' ); + +eval 'read($bla, FILE, 1);'; +like( $@, qr/^Can't modify constant item in read /, + 'read($var, FILE, 1) segfaults on 5.6.1 [ID 20011025.054]' ); # This used to dump core (bug #17920) eval q{ sub { sub { f1(f2();); my($a,$b,$c) } } }; -print $@ && $@ =~ /error/ ? "ok 1\n" : "not ok 1\n"; +like( $@, qr/error/, 'lexical block discarded by yacc' ); diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t index f8bf4b3178..9c3e55c4ef 100644 --- a/t/run/fresh_perl.t +++ b/t/run/fresh_perl.t @@ -4,20 +4,9 @@ # Instead, put the test in the appropriate test file and use the # fresh_perl_is()/fresh_perl_like() functions in t/test.pl. -# This is for tests that will normally cause segfaults, and other nasty +# This is for tests that used to abnormally cause segfaults, and other nasty # errors that might kill the interpreter and for some reason you can't # use an eval(). -# -# New tests are added to the bottom. For example. -# -# ######## perlbug ID 20020831.001 -# ($a, b) = (1,2) -# EXPECT -# Can't modify constant item in list assignment - at line 1 -# -# to test that the code "($a, b) = (1,2)" causes the appropriate syntax -# error, rather than just segfaulting as reported in perlbug ID -# 20020831.001 BEGIN { chdir 't' if -d 't'; @@ -114,11 +103,6 @@ print $aa; EXPECT 12345 ######## -%@x=0; -EXPECT -Can't modify hash dereference in repeat (x) at - line 1, near "0;" -Execution of - aborted due to compilation errors. -######## $_="foo"; printf(STDOUT "%s\n", $_); EXPECT @@ -688,18 +672,6 @@ OK EXPECT ok ######## -# Bug 20010422.005 -{s//${}/; //} -EXPECT -syntax error at - line 2, near "${}" -Execution of - aborted due to compilation errors. -######## -# Bug 20010528.007 -"\x{" -EXPECT -Missing right brace on \x{} at - line 2, within string -Execution of - aborted due to compilation errors. -######## my $foo = Bar->new(); my @dst; END { @@ -717,26 +689,6 @@ sub DESTROY { } EXPECT Bar=ARRAY(0x...) -######## -######## found by Markov chain stress testing -eval "a.b.c.d.e.f;sub" -EXPECT - -######## perlbug ID 20010831.001 -($a, b) = (1, 2); -EXPECT -Can't modify constant item in list assignment at - line 1, near ");" -Execution of - aborted due to compilation errors. -######## tying a bareword causes a segfault in 5.6.1 -tie FOO, "Foo"; -EXPECT -Can't modify constant item in tie at - line 1, near ""Foo";" -Execution of - aborted due to compilation errors. -######## undefing constant causes a segfault in 5.6.1 [ID 20010906.019] -undef foo; -EXPECT -Can't modify constant item in undef operator at - line 1, near "foo;" -Execution of - aborted due to compilation errors. ######## (?{...}) compilation bounces on PL_rs -0 { @@ -746,11 +698,6 @@ Execution of - aborted due to compilation errors. BEGIN { print "ok\n" } EXPECT ok -######## read($var, FILE, 1) segfaults on 5.6.1 [ID 20011025.054] -read($bla, FILE, 1); -EXPECT -Can't modify constant item in read at - line 1, near "1)" -Execution of - aborted due to compilation errors. ######## scalar ref to file test operator segfaults on 5.6.1 [ID 20011127.155] # This only happens if the filename is 11 characters or less. $foo = \-f "blah"; |