Pack Patch (was Re: 5.002 - pack/unpack does not do "I" right)
[p5sagit/p5-mst-13.2.git] / t / op / write.t
1 #!./perl
2
3 # $RCSfile: write.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:38 $
4
5 print "1..3\n";
6
7 format OUT =
8 the quick brown @<<
9 $fox
10 jumped
11 @*
12 $multiline
13 ^<<<<<<<<<
14 $foo
15 ^<<<<<<<<<
16 $foo
17 ^<<<<<<...
18 $foo
19 now @<<the@>>>> for all@|||||men to come @<<<<
20 {
21     'i' . 's', "time\n", $good, 'to'
22 }
23 .
24
25 open(OUT, '>Op_write.tmp') || die "Can't create Op_write.tmp";
26
27 $fox = 'foxiness';
28 $good = 'good';
29 $multiline = "forescore\nand\nseven years\n";
30 $foo = 'when in the course of human events it becomes necessary';
31 write(OUT);
32 close OUT;
33
34 $right =
35 "the quick brown fox
36 jumped
37 forescore
38 and
39 seven years
40 when in
41 the course
42 of huma...
43 now is the time for all good men to come to\n";
44
45 if (`cat Op_write.tmp` eq $right)
46     { print "ok 1\n"; unlink 'Op_write.tmp'; }
47 else
48     { print "not ok 1\n"; }
49
50 $fox = 'wolfishness';
51 my $fox = 'foxiness';           # Test a lexical variable.
52
53 format OUT2 =
54 the quick brown @<<
55 $fox
56 jumped
57 @*
58 $multiline
59 ^<<<<<<<<< ~~
60 $foo
61 now @<<the@>>>> for all@|||||men to come @<<<<
62 'i' . 's', "time\n", $good, 'to'
63 .
64
65 open OUT2, '>Op_write.tmp' or die "Can't create Op_write.tmp";
66
67 $good = 'good';
68 $multiline = "forescore\nand\nseven years\n";
69 $foo = 'when in the course of human events it becomes necessary';
70 write(OUT2);
71 close OUT2;
72
73 $right =
74 "the quick brown fox
75 jumped
76 forescore
77 and
78 seven years
79 when in
80 the course
81 of human
82 events it
83 becomes
84 necessary
85 now is the time for all good men to come to\n";
86
87 if (`cat Op_write.tmp` eq $right)
88     { print "ok 2\n"; unlink 'Op_write.tmp'; }
89 else
90     { print "not ok 2\n"; }
91
92 eval <<'EOFORMAT';
93 format OUT2 =
94 the brown quick @<<
95 $fox
96 jumped
97 @*
98 $multiline
99 and
100 ^<<<<<<<<< ~~
101 $foo
102 now @<<the@>>>> for all@|||||men to come @<<<<
103 'i' . 's', "time\n", $good, 'to'
104 .
105 EOFORMAT
106
107 open(OUT2, '>Op_write.tmp') || die "Can't create Op_write.tmp";
108
109 $fox = 'foxiness';
110 $good = 'good';
111 $multiline = "forescore\nand\nseven years\n";
112 $foo = 'when in the course of human events it becomes necessary';
113 write(OUT2);
114 close OUT2;
115
116 $right =
117 "the brown quick fox
118 jumped
119 forescore
120 and
121 seven years
122 and
123 when in
124 the course
125 of human
126 events it
127 becomes
128 necessary
129 now is the time for all good men to come to\n";
130
131 if (`cat Op_write.tmp` eq $right)
132     { print "ok 3\n"; unlink 'Op_write.tmp'; }
133 else
134     { print "not ok 3\n"; }
135