Minor S5 tweaks and Sync with Latest HTML5lib
This commit is contained in:
parent
dbed460843
commit
81d3cdc8e4
81 changed files with 9887 additions and 1687 deletions
24
vendor/plugins/HTML5lib/tests/test_parser.rb
vendored
24
vendor/plugins/HTML5lib/tests/test_parser.rb
vendored
|
@ -26,8 +26,9 @@ class Html5ParserTestCase < Test::Unit::TestCase
|
|||
test_name = File.basename(test_file).sub('.dat', '')
|
||||
|
||||
TestData.new(test_file, %w(data errors document-fragment document)).
|
||||
each_with_index do |(input, errors, innerHTML, expected), index|
|
||||
each_with_index do |(input, errors, inner_html, expected), index|
|
||||
|
||||
errors = errors.split("\n")
|
||||
expected = expected.gsub("\n| ","\n")[2..-1]
|
||||
|
||||
$tree_types_to_test.each do |tree_name|
|
||||
|
@ -35,8 +36,8 @@ class Html5ParserTestCase < Test::Unit::TestCase
|
|||
|
||||
parser = HTMLParser.new(:tree => TreeBuilders[tree_name])
|
||||
|
||||
if innerHTML
|
||||
parser.parseFragment(input, innerHTML)
|
||||
if inner_html
|
||||
parser.parse_fragment(input, inner_html)
|
||||
else
|
||||
parser.parse(input)
|
||||
end
|
||||
|
@ -49,16 +50,15 @@ class Html5ParserTestCase < Test::Unit::TestCase
|
|||
'', 'Recieved:', actual_output
|
||||
].join("\n")
|
||||
|
||||
if $CHECK_PARSER_ERRORS
|
||||
actual_errors = parser.errors.map do |(line, col), message|
|
||||
'Line: %i Col: %i %s' % [line, col, message]
|
||||
end
|
||||
assert_equal errors.length, parser.errors.length, [
|
||||
'Input', input + "\n",
|
||||
'Expected errors:', errors.join("\n"),
|
||||
'Actual errors:', actual_errors.join("\n")
|
||||
].join("\n")
|
||||
actual_errors = parser.errors.map do |(line, col), message|
|
||||
'Line: %i Col: %i %s' % [line, col, message]
|
||||
end
|
||||
assert_equal errors.length, parser.errors.length, [
|
||||
'', 'Input', input,
|
||||
'', "Expected errors (#{errors.length}):", errors.join("\n"),
|
||||
'', "Actual errors (#{actual_errors.length}):",
|
||||
actual_errors.join("\n")
|
||||
].join("\n")
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue