Class: TestValidator

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/feed_tools/vendor/html5/tests/test_validator.rb

Instance Method Summary collapse

Instance Method Details

#run_validator_test(test) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/feed_tools/vendor/html5/tests/test_validator.rb', line 9

def run_validator_test(test)
  p = HTML5::HTMLParser.new(:tokenizer => HTMLConformanceChecker)
  p.parse(test['input'])
  errorCodes = p.errors.collect{|e| e[1]}
  if test.has_key?('fail-if')
    assert !errorCodes.include?(test['fail-if'])
  end
  if test.has_key?('fail-unless')
    assert errorCodes.include?(test['fail-unless'])
  end
end