Avoid re-creating a temporary file with constant contents for use.t
Nicholas Clark [Fri, 18 Sep 2009 13:14:57 +0000 (14:14 +0100)]
MANIFEST
t/comp/use.t
t/lib/test_use_14937.pm [new file with mode: 0644]

index 20bdcd0..b987cc7 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4203,6 +4203,7 @@ t/lib/Sans_mypragma.pm                    Test module for t/lib/mypragma.t
 t/lib/strict/refs              Tests of "use strict 'refs'" for strict.t
 t/lib/strict/subs              Tests of "use strict 'subs'" for strict.t
 t/lib/strict/vars              Tests of "use strict 'vars'" for strict.t
+t/lib/test_use_14937.pm                A test pragma for t/comp/use.t
 t/lib/test_use.pm              A test pragma for t/comp/use.t
 t/lib/warnings/1global         Tests of global warnings for warnings.t
 t/lib/warnings/2use            Tests for "use warnings" for warnings.t
index 56d2d81..a7ecda8 100755 (executable)
@@ -191,12 +191,9 @@ is("@test_use::got", "joe");
 {
     # Regression test for patch 14937: 
     #   Check that a .pm file with no package or VERSION doesn't core.
-    open F, ">xxx$$.pm" or die "Cannot open xxx$$.pm: $!\n";
-    print F "1;\n";
-    close F;
-    eval "BEGIN {unshift \@INC, '.'}; use xxx$$ 3;";
-    like ($@, qr/^xxx$$ defines neither package nor VERSION--version check failed at/);
-    unlink "xxx$$.pm";
+    # (git commit 2658f4d9934aba5f8b23afcc078dc12b3a40223)
+    eval "use test_use_14937 3";
+    like ($@, qr/^test_use_14937 defines neither package nor VERSION--version check failed at/);
 }
 
 my @ver = split /\./, sprintf "%vd", $^V;
diff --git a/t/lib/test_use_14937.pm b/t/lib/test_use_14937.pm
new file mode 100644 (file)
index 0000000..0afc604
--- /dev/null
@@ -0,0 +1 @@
+1;