Commit | Line | Data |
be25f609 |
1 | #!./perl |
2 | |
341b7876 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | require './test.pl'; |
7 | } |
be25f609 |
8 | |
341b7876 |
9 | use strict; |
10 | |
29e8de64 |
11 | plan 5; |
341b7876 |
12 | |
13 | my $err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n"; |
be25f609 |
14 | |
15 | eval { ... }; |
16 | |
341b7876 |
17 | is $@, $err; |
29e8de64 |
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 | } |