Subject: | 05-blind-cache.t fails on read-only distribution |
I upgraded HTML-Template in our Perforce repository to 2.9, and the
05-blind-cache.t test fails when I build and test the module without
opening templates/simple.tmpl for editing first.
My simple fix is to just make the file writable before trying to
overwrite it:
====
//depot/main/Camel/src/cpan/H/HTML/HTML-Template/main/t/05-blind-cache.t#1
- d:\p4view\Camel\src\cpan\H\HTML\HTML-Template\main\t\05-blind-cache.t ====
@@ -24,6 +24,7 @@
ok( copy('templates/simple.tmpl', 'templates/notsosimple.tmpl'),
"stored simple.tmpl for later restoration");
+chmod(0666, 'templates/simple.tmpl');
ok( copy('templates/simplemod.tmpl', 'templates/simple.tmpl'),
"poured new content into simple.tmpl to test blind_cache");
@@ -36,6 +37,7 @@
);
ok($output =~ /v1e2r3y/, "output unchanged as expected");
+chmod(0666, 'templates/simple.tmpl');
ok( copy('templates/notsosimple.tmpl', 'templates/simple.tmpl'),
"able to restore original content of simple.tmpl");
ok( unlink('templates/notsosimple.tmpl'),
But a better solution would probably to not modify any files part of the
original distribution during the test phase. If the test script fails
completely before restoring the original file, you would end up with a
broken local copy.