Move the require './test.pl' to the end of t/comp/hints.t
[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
62a28c97 9my @tfiles = (tempfile(), tempfile(), tempfile());
10my @tfiles_bak = map "$_$^I", @tfiles;
99ec4a7e 11
62a28c97 12END { unlink_all(@tfiles_bak); }
99ec4a7e 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