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