diff options
author | Sam Tregar <sam@tregar.com> | 2002-01-02 09:04:26 -0500 |
---|---|---|
committer | Abhijit Menon-Sen <ams@wiw.org> | 2002-01-02 18:34:26 +0000 |
commit | d37a953848a8a5e776efddc4a0591621effaf5f1 (patch) | |
tree | fed7ad7eafb008d18686846b7b34ce3c9f02138e /t/comp | |
parent | 96af66be42b7864817b8cbb1e321096e1a058501 (diff) | |
download | perl-d37a953848a8a5e776efddc4a0591621effaf5f1.tar.gz |
Bad prototype detection changed from error to warning
Message-Id: <Pine.LNX.4.33.0201021400110.15420-200000@localhost.localdomain>
p4raw-id: //depot/perl@14025
Diffstat (limited to 't/comp')
-rwxr-xr-x | t/comp/proto.t | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/t/comp/proto.t b/t/comp/proto.t index da3af2890d..32b1fad8ee 100755 --- a/t/comp/proto.t +++ b/t/comp/proto.t @@ -16,7 +16,7 @@ BEGIN { use strict; -print "1..134\n"; +print "1..135\n"; my $i = 1; @@ -528,20 +528,29 @@ print "ok ", $i++, "\n"; print "ok ", $i++, "\n"; } -# check that obviously bad prototypes are getting rejected -eval 'sub badproto (@bar) { 1; }'; -print "not " unless $@ =~ /^Malformed prototype for main::badproto : \@bar/; -print "ok ", $i++, "\n"; - -eval 'sub badproto2 (bar) { 1; }'; -print "not " unless $@ =~ /^Malformed prototype for main::badproto2 : bar/; -print "ok ", $i++, "\n"; +# check that obviously bad prototypes are getting warnings +{ + my $warn = ""; + local $SIG{__WARN__} = sub { $warn .= join("",@_) }; + + eval 'sub badproto (@bar) { 1; }'; + print "not " unless $warn =~ /Illegal character in prototype for main::badproto : \@bar/; + print "ok ", $i++, "\n"; -eval 'sub badproto3 (&$bar$@) { 1; }'; -print "not " unless $@ =~ /^Malformed prototype for main::badproto3 : &\$bar\$\@/; -print "ok ", $i++, "\n"; + eval 'sub badproto2 (bar) { 1; }'; + print "not " unless $warn =~ /Illegal character in prototype for main::badproto2 : bar/; + print "ok ", $i++, "\n"; + + eval 'sub badproto3 (&$bar$@) { 1; }'; + print "not " unless $warn =~ /Illegal character in prototype for main::badproto3 : &\$bar\$\@/; + print "ok ", $i++, "\n"; + + eval 'sub badproto4 (@ $b ar) { 1; }'; + print "not " unless $warn =~ /Illegal character in prototype for main::badproto4 : \@\$bar/; + print "ok ", $i++, "\n"; +} -eval 'sub badproto4 (@ $b ar) { 1; }'; -print "not " unless $@ =~ /^Malformed prototype for main::badproto4 : \@\$bar/; +# make sure whitespace in prototypes works +eval "sub good (\$\t\$\n\$) { 1; }"; +print "not " if $@; print "ok ", $i++, "\n"; - |