diff options
author | Colin Kuskie <ckuskie@cadence.com> | 1998-07-07 02:44:33 -0700 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-08 03:58:19 +0000 |
commit | 2d259d9294e79c03b1a69d3eaac3d6e5647468d7 (patch) | |
tree | 6d9fee2ffac45928e6e7211e6e579e238a84d8e1 /t/io | |
parent | d426b052dee31c20224ef2893d5c969ad5a2c617 (diff) | |
download | perl-2d259d9294e79c03b1a69d3eaac3d6e5647468d7.tar.gz |
added patch for -i'foo*bar', made code somewhat simpler, tweaked doc
Message-ID: <Pine.GSO.3.96.980707093457.28681A-100000@pdxue150.cadence.com>
Subject: Corrected -i prefix patch
p4raw-id: //depot/perl@1368
Diffstat (limited to 't/io')
-rwxr-xr-x | t/io/iprefix.t | 30 |
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'; |