xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/SelectSaver.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't' if -d 't';
5*0Sstevel@tonic-gate    @INC = '../lib';
6*0Sstevel@tonic-gate}
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gateprint "1..3\n";
9*0Sstevel@tonic-gate
10*0Sstevel@tonic-gateuse SelectSaver;
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gateopen(FOO, ">foo-$$") || die;
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gateprint "ok 1\n";
15*0Sstevel@tonic-gate{
16*0Sstevel@tonic-gate    my $saver = new SelectSaver(FOO);
17*0Sstevel@tonic-gate    print "foo\n";
18*0Sstevel@tonic-gate}
19*0Sstevel@tonic-gate
20*0Sstevel@tonic-gate# Get data written to file
21*0Sstevel@tonic-gateopen(FOO, "foo-$$") || die;
22*0Sstevel@tonic-gatechomp($foo = <FOO>);
23*0Sstevel@tonic-gateclose FOO;
24*0Sstevel@tonic-gateunlink "foo-$$";
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gateprint "ok 2\n" if $foo eq "foo";
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gateprint "ok 3\n";
29