Ignores comment lines.

This commit is contained in:
Luka Vandervelden 2020-11-23 23:09:20 +01:00
parent bb64ff99ac
commit 3414569db2

View File

@ -35,12 +35,16 @@ module Tap
tap : Tap::Suite? = nil
text.lines.each do |line|
md = line.match(/^([0-9]+)\.\.([0-9]+)$/)
if md
if md = line.match /^[ \t]*#.*$/
# Comments, currently ignored.
next
end
if md = line.match(/^([0-9]+)\.\.([0-9]+)$/)
unless tap
tap = Tap::Suite.new md[2].to_i
else
if (tap.size+1) != md[2].to_i
if tap.size != md[2].to_i
raise ParserError.new "Number of tests parsed does not match number of tests written in suite."
end
end
@ -48,8 +52,7 @@ module Tap
next
end
md = line.match(/^(not ok|ok) ([0-9]+) *- *([^#]*)(#.*)?$/)
if md
if md = line.match(/^(not ok|ok) ([0-9]+) *- *([^#]*)(#.*)?$/)
unless tap
tap = Tap::Suite.new
end