From cbf45e8454c586302a9f324433b3155521872636 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 1 Sep 2013 14:26:29 -0700 Subject: [PATCH] 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. --- t/comp/parser.t | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/t/comp/parser.t b/t/comp/parser.t index 44106cb..cca4966 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 -<${...}/')}"; +${check_line(25, 'line number inside qq/${...}/')}"; __END__ # Don't add new tests HERE. See note above -- 1.8.3.1