summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-09-01 14:26:29 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-09-01 14:47:10 -0700
commitcbf45e8454c586302a9f324433b3155521872636 (patch)
treec66b39cfa08fae4e1fc15f752d0115e64b7444f2 /t/comp
parent65c68e17188d09c96250348d769c0c309500d5b9 (diff)
downloadperl-cbf45e8454c586302a9f324433b3155521872636.tar.gz
Refactor some parser.t line number tests
The check() function is designed to check the file set by #line, but the last half dozen tests have no need to test for that. (I know because I wrote them.) So make a new check_line function that just checks the line number, and have them use that.
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/parser.t22
1 files changed, 14 insertions, 8 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 44106cb9d8..cca4966b85 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
chdir 't';
}
-print "1..166\n";
+print "1..159\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -576,29 +576,35 @@ eval <<'EOSTANZA'; die $@ if $@;
check(qr/^Great hail!.*no more\.$/, 61, "Overflow both small buffer checks");
EOSTANZA
+sub check_line ($$) {
+ my ($line, $name) = @_;
+ my (undef, undef, $got_line) = caller;
+ is ($got_line, $line, $name);
+}
+
#line 531 parser.t
-<<EOU; check('parser\.t', 531, 'on same line as heredoc');
+<<EOU; check_line(531, 'on same line as heredoc');
EOU
s//<<EOV/e if 0;
EOV
-check('parser\.t', 535, 'after here-doc in quotes');
+check_line(535, 'after here-doc in quotes');
<<EOW;
-${check('parser\.t', 537, 'first line of interp in here-doc');;
- check('parser\.t', 538, 'second line of interp in here-doc');}
+${check_line(537, 'first line of interp in here-doc');;
+ check_line(538, 'second line of interp in here-doc');}
EOW
time
#line 42
-;check('parser\.t', 42, 'line number after "nullary\n#line"');
+;check_line(42, 'line number after "nullary\n#line"');
"${
#line 53
_}";
-check('parser\.t', 54, 'line number after qq"${#line}"');
+check_line(54, 'line number after qq"${#line}"');
#line 24
"
-${check('parser\.t', 25, 'line number inside qq/<newline>${...}/')}";
+${check_line(25, 'line number inside qq/<newline>${...}/')}";
__END__
# Don't add new tests HERE. See note above