From cb6549168652d739d74a63b2d05566e796a3357f Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 7 Apr 2023 10:56:06 -0400 Subject: [PATCH] test: improved some failure messages in html5lib-test wrapper --- test/html5/test_tree_construction.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/html5/test_tree_construction.rb b/test/html5/test_tree_construction.rb index c0124aaa5ce..ac4684227ee 100644 --- a/test/html5/test_tree_construction.rb +++ b/test/html5/test_tree_construction.rb @@ -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, @@ -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