Skip to content

Commit

Permalink
test: improved some failure messages in html5lib-test wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Apr 7, 2023
1 parent b1bb7c5 commit cb65491
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/html5/test_tree_construction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def compare_nodes(node, ng_node)
else
attributes[attr[:name]].value
end
assert_equal(attr[:value], value)
assert_equal(attr[:value], value, "expected #{attr}[:value] to equal #{value.inspect}")
end
assert_equal(
node[:children].length,
Expand Down Expand Up @@ -117,7 +117,12 @@ def run_test
end

# Test the errors.
assert_equal(@test[:errors].length, doc.errors.length, "Wrong number of errors for #{@test[:data]}")
errpayload = doc.errors.map(&:to_s).join("\n")
assert_equal(
@test[:errors].length,
doc.errors.length,
"Expected #{@test[:errors].length} errors for #{@test[:data]}, found:\n#{errpayload}",
)

# The new, standardized tokenizer errors live in @test[:new_errors]. Let's
# match each one to exactly one error in doc.errors. Unfortunately, the
Expand Down

0 comments on commit cb65491

Please sign in to comment.