This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make utf8::encode respect magic
[perl5.git] / t / op / yadayada.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require './test.pl';
7 }
8
9 use strict;
10
11 plan 5;
12
13 my $err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n";
14
15 eval { ... };
16
17 is $@, $err;
18
19
20 #
21 # Regression tests, making sure ... is still parsable as an operator.
22 #
23 my @lines = split /\n/ => <<'--';
24
25 # Check simple range operator.
26 my @arr = 'A' ... 'D';
27
28 # Range operator with print.
29 print 'D' ... 'A';
30
31 # Without quotes, 'D' could be a file handle.
32 print  D  ...  A ;
33
34 # Another possible interaction with a file handle.
35 print ${\"D"}  ...  A ;
36 --
37
38 foreach my $line (@lines) {
39     next if $line =~ /^\s*#/ || $line !~ /\S/;
40     my $mess = qq {Parsing '...' in "$line" as a range operator};
41     eval qq {
42        {local *STDOUT; no strict "subs"; $line;}
43         pass \$mess;
44         1;
45     } or do {
46         my $err = $@;
47         $err =~ s/\n//g;
48         fail "$mess ($err)";
49     }
50 }