This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0: (no announcement message available)
[perl5.git] / t / op.write
... / ...
CommitLineData
1#!./perl
2
3# $Header: op.write,v 3.0 89/10/18 15:32:16 lwall Locked $
4
5print "1..2\n";
6
7format OUT =
8the quick brown @<<
9$fox
10jumped
11@*
12$multiline
13^<<<<<<<<<
14$foo
15^<<<<<<<<<
16$foo
17^<<<<<<...
18$foo
19now @<<the@>>>> for all@|||||men to come @<<<<
20'i' . 's', "time\n", $good, 'to'
21.
22
23open(OUT, '>Op.write.tmp') || die "Can't create Op.write.tmp";
24
25$fox = 'foxiness';
26$good = 'good';
27$multiline = "forescore\nand\nseven years\n";
28$foo = 'when in the course of human events it becomes necessary';
29write(OUT);
30close OUT;
31
32$right =
33"the quick brown fox
34jumped
35forescore
36and
37seven years
38when in
39the course
40of huma...
41now is the time for all good men to come to\n";
42
43if (`cat Op.write.tmp` eq $right)
44 { print "ok 1\n"; unlink 'Op.write.tmp'; }
45else
46 { print "not ok 1\n"; }
47
48format OUT2 =
49the quick brown @<<
50$fox
51jumped
52@*
53$multiline
54^<<<<<<<<< ~~
55$foo
56now @<<the@>>>> for all@|||||men to come @<<<<
57'i' . 's', "time\n", $good, 'to'
58.
59
60open(OUT2, '>Op.write.tmp') || die "Can't create Op.write.tmp";
61
62$fox = 'foxiness';
63$good = 'good';
64$multiline = "forescore\nand\nseven years\n";
65$foo = 'when in the course of human events it becomes necessary';
66write(OUT2);
67close OUT2;
68
69$right =
70"the quick brown fox
71jumped
72forescore
73and
74seven years
75when in
76the course
77of human
78events it
79becomes
80necessary
81now is the time for all good men to come to\n";
82
83if (`cat Op.write.tmp` eq $right)
84 { print "ok 2\n"; unlink 'Op.write.tmp'; }
85else
86 { print "not ok 2\n"; }
87