Removing the auto-newline appending in fresh_perl_is() exposed some newline
sloppiness in t/run/fresh_perl.t.

* When switches were stripped from test code a blank line was left.
  This confused attempts by fresh_perl to display the first line of the
  program as a default name.

* Some programs have no expected output, we only care that they don't
  segfault.  These would warn as the expected output was undef.

* Tests with no switches generated undef warnings.

* Separating the test into the program and the expected part stripped
  the trailing newline off the program causing a test to fail which
  ended in a here-doc separator.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
Reality is that which, when you stop believing in it, doesn't go away.
        -- Phillip K. Dick
--- run/fresh_perl.t    2005/07/22 19:39:34     1.1
+++ run/fresh_perl.t    2005/07/22 19:47:35
@@ -35,11 +35,13 @@
     my($raw_prog, $name) = @$prog;
 
     my $switch;
-    if ($raw_prog =~ s/^\s*(-\w.*)//){
+    if ($raw_prog =~ s/^\s*(-\w.*)\n//){
        $switch = $1;
     }
 
     my($prog,$expected) = split(/\nEXPECT\n/, $raw_prog);
+    $prog .= "\n";
+    $expected = '' unless defined $expected;
 
     if ($prog =~ /^\# SKIP: (.+)/m) {
        if (eval $1) {
@@ -50,7 +52,7 @@
 
     $expected =~ s/\n+$//;
 
-    fresh_perl_is($prog, $expected, { switches => [$switch] }, $name);
+    fresh_perl_is($prog, $expected, { switches => [$switch || ''] }, $name);
 }
 
 __END__
@@ -383,7 +385,7 @@
 -w
 sub testme { my $a = "test"; { local $a = "new test"; print $a }}
 EXPECT
-Can't localize lexical variable $a at - line 2.
+Can't localize lexical variable $a at - line 1.
 ########
 package X;
 sub ascalar { my $r; bless \$r }
@@ -510,7 +512,7 @@
   if ($x == 0) { print "" } else { print $x }
 }
 EXPECT
-Use of uninitialized value $x in numeric eq (==) at - line 4.
+Use of uninitialized value $x in numeric eq (==) at - line 3.
 ########
 $x = sub {};
 foo();
@@ -651,8 +653,9 @@
 close STDERR; die;
 EXPECT
 ########
+# core dump in 20000716.007
 -w
-"x" =~ /(\G?x)?/;      # core dump in 20000716.007
+"x" =~ /(\G?x)?/;
 ########
 # Bug 20010515.004
 my @h = 1 .. 10;

Reply via email to