diff options
author | Abigail <abigail@abigail.be> | 2010-01-28 21:16:33 +0100 |
---|---|---|
committer | Abigail <abigail@abigail.be> | 2010-01-28 21:16:33 +0100 |
commit | 29e8de644e207ef3b137f2f7fe42ee1297ced166 (patch) | |
tree | 82855358e850e619f028dd4439f947dbde8ab830 | |
parent | b8b7c8fb3f5b289a340b19d1d319a41f26629c85 (diff) | |
download | perl-29e8de644e207ef3b137f2f7fe42ee1297ced166.tar.gz |
Add a few regression tests, making sure ... is parsed as a range operator
-rw-r--r-- | t/op/yadayada.t | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/t/op/yadayada.t b/t/op/yadayada.t index f82aa72537..770a51ea90 100644 --- a/t/op/yadayada.t +++ b/t/op/yadayada.t @@ -8,10 +8,43 @@ BEGIN { use strict; -plan 1; +plan 5; my $err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { ... }; is $@, $err; + + +# +# Regression tests, making sure ... is still parsable as an operator. +# +my @lines = split /\n/ => <<'--'; + +# Check simple range operator. +my @arr = 'A' ... 'D'; + +# Range operator with print. +print 'D' ... 'A'; + +# Without quotes, 'D' could be a file handle. +print D ... A ; + +# Another possible interaction with a file handle. +print ${\"D"} ... A ; +-- + +foreach my $line (@lines) { + next if $line =~ /^\s*#/ || $line !~ /\S/; + my $mess = qq {Parsing '...' in "$line" as a range operator}; + eval qq { + {local *STDOUT; no strict "subs"; $line;} + pass \$mess; + 1; + } or do { + my $err = $@; + $err =~ s/\n//g; + fail "$mess ($err)"; + } +} |