Commit | Line | Data |
---|---|---|
2a507800 BF |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't'; | |
5 | @INC = '../lib'; | |
6 | require './test.pl'; | |
7 | } | |
8 | ||
9 | plan tests => 7; | |
10 | ||
11 | use utf8; | |
12 | use open qw( :utf8 :std ); | |
13 | ||
14 | # [perl #19566]: sv_gets writes directly to its argument via | |
15 | # TARG. Test that we respect SvREADONLY. | |
16 | eval { for (\2) { $_ = <Fʜ> } }; | |
17 | like($@, 'Modification of a read-only value attempted', '[perl #19566]'); | |
18 | ||
19 | # [perl #21628] | |
20 | { | |
21 | my $file = tempfile(); | |
22 | open Ạ,'+>',$file; $a = 3; | |
23 | is($a .= <Ạ>, 3, '#21628 - $a .= <A> , A eof'); | |
12578451 | 24 | close Ạ; $a = 4; |
2a507800 BF |
25 | is($a .= <Ạ>, 4, '#21628 - $a .= <A> , A closed'); |
26 | } | |
27 | ||
28 | use strict; | |
29 | ||
30 | open ᕝ, '.' and sysread ᕝ, $_, 1; | |
31 | my $err = $! + 0; | |
32 | close ᕝ; | |
33 | ||
34 | SKIP: { | |
35 | skip "you can read directories as plain files", 2 unless( $err ); | |
36 | ||
37 | $!=0; | |
38 | open ᕝ, '.' and $_=<ᕝ>; | |
39 | ok( $!==$err && !defined($_) => 'readline( DIRECTORY )' ); | |
40 | close ᕝ; | |
41 | ||
42 | $!=0; | |
43 | { local $/; | |
44 | open ᕝ, '.' and $_=<ᕝ>; | |
45 | ok( $!==$err && !defined($_) => 'readline( DIRECTORY ) slurp mode' ); | |
46 | close ᕝ; | |
47 | } | |
48 | } | |
49 | ||
50 | my $obj = bless [], "Ȼლᔆ"; | |
51 | $obj .= <DATA>; | |
52 | like($obj, qr/Ȼლᔆ=ARRAY.*world/u, 'rcatline and refs'); | |
53 | ||
54 | { | |
55 | my $file = tempfile(); | |
56 | open my $out_fh, ">", $file; | |
57 | print { $out_fh } "Data\n"; | |
58 | close $out_fh; | |
59 | ||
60 | open hòฟ, "<", $file; | |
61 | is( scalar(<hòฟ>), "Data\n", "readline() works correctly on UTF-8 filehandles" ); | |
62 | close hòฟ; | |
63 | } | |
64 | ||
65 | __DATA__ | |
66 | world |