summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
Diffstat (limited to 't/io')
-rwxr-xr-xt/io/iprefix.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/io/iprefix.t b/t/io/iprefix.t
new file mode 100755
index 0000000000..b7ade31576
--- /dev/null
+++ b/t/io/iprefix.t
@@ -0,0 +1,30 @@
+#!./perl
+
+$^I = 'bak*';
+
+# Modified from the original inplace.t to test adding prefixes
+
+print "1..2\n";
+
+@ARGV = ('.a','.b','.c');
+if ($^O eq 'MSWin32') {
+ $CAT = '.\perl -e "print<>"';
+ `.\\perl -le "print 'foo'" > .a`;
+ `.\\perl -le "print 'foo'" > .b`;
+ `.\\perl -le "print 'foo'" > .c`;
+}
+else {
+ $CAT = 'cat';
+ `echo foo | tee .a .b .c`;
+}
+while (<>) {
+ s/foo/bar/;
+}
+continue {
+ print;
+}
+
+if (`$CAT .a .b .c` eq "bar\nbar\nbar\n") {print "ok 1\n";} else {print "not ok 1\n";}
+if (`$CAT bak.a bak.b bak.c` eq "foo\nfoo\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
+
+unlink '.a', '.b', '.c', 'bak.a', 'bak.b', 'bak.c';