[patch@34016] VMS passes these t/io/open.t tests now.
[p5sagit/p5-mst-13.2.git] / t / io / inplace.t
CommitLineData
fe14fcc3 1#!./perl
99ec4a7e 2use strict;
3require './test.pl';
8d063cd8 4
103a9d15 5$^I = $^O eq 'VMS' ? '_bak' : '.bak';
fe14fcc3 6
99ec4a7e 7plan( tests => 2 );
8d063cd8 8
99ec4a7e 9my @tfiles = ('.a','.b','.c');
10my @tfiles_bak = (".a$^I", ".b$^I", ".c$^I");
11
12END { unlink_all('.a','.b','.c',".a$^I", ".b$^I", ".c$^I"); }
13
14for my $file (@tfiles) {
15 runperl( prog => 'print qq(foo\n);',
16 args => ['>', $file] );
68dc0745 17}
99ec4a7e 18
19@ARGV = @tfiles;
20
8d063cd8 21while (<>) {
22 s/foo/bar/;
23}
24continue {
25 print;
26}
27
99ec4a7e 28is ( runperl( prog => 'print<>;', args => \@tfiles ),
29 "bar\nbar\nbar\n",
30 "file contents properly replaced" );
31
32is ( runperl( prog => 'print<>;', args => \@tfiles_bak ),
33 "foo\nfoo\nfoo\n",
34 "backup file contents stay the same" );
8d063cd8 35