C++: Solaris CC now compiles "perl"
[p5sagit/p5-mst-13.2.git] / t / comp / parser.t
index 645e6e2..a050858 100644 (file)
@@ -9,7 +9,7 @@ BEGIN {
 }
 
 require "./test.pl";
-plan( tests => 54 );
+plan( tests => 60 );
 
 eval '%@x=0;';
 like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -23,6 +23,13 @@ eval q/"\x{"/;
 like( $@, qr/^Missing right brace on \\x/,
     'syntax error in string, used to dump core' );
 
+eval q/"\N{"/;
+like( $@, qr/^Missing right brace on \\N/,
+    'syntax error in string with incomplete \N' );
+eval q/"\Nfoo"/;
+like( $@, qr/^Missing braces on \\N/,
+    'syntax error in string with incomplete \N' );
+
 eval "a.b.c.d.e.f;sub";
 like( $@, qr/^Illegal declaration of anonymous subroutine/,
     'found by Markov chain stress testing' );
@@ -128,7 +135,7 @@ EOF
 {
     local $SIG{__WARN__} = sub { }; # silence mandatory warning
     eval q{ my $x = -F 1; };
-    like( $@, qr/(?:syntax|parse) error .* near "F 1"/, "unknown filetest operators" );
+    like( $@, qr/(?i:syntax|parse) error .* near "F 1"/, "unknown filetest operators" );
     is(
         eval q{ sub F { 42 } -F 1 },
        '-42',
@@ -190,3 +197,16 @@ EOF
     like($@, qr/That use of \$\[ is unsupported/,
              'cannot assign list of <1 elements to $[');
 }
+
+# tests for "Bad name"
+eval q{ foo::$bar };
+like( $@, qr/Bad name after foo::/, 'Bad name after foo::' );
+eval q{ foo''bar };
+like( $@, qr/Bad name after foo'/, 'Bad name after foo\'' );
+
+# test for ?: context error
+eval q{($a ? $x : ($y)) = 5};
+like( $@, qr/Assignment to both a list and a scalar/, 'Assignment to both a list and a scalar' );
+
+eval q{ s/x/#/e };
+is( $@, '', 'comments in s///e' );