Module: HTML5::TestSupport

Included in:
TestTreeWalkers
Defined in:
lib/feed_tools/vendor/html5/tests/preamble.rb

Defined Under Namespace

Classes: TestData

Instance Method Summary collapse

Instance Method Details

#convertTreeDump(treedump) ⇒ Object

convert the output of str(document) to the format used in the testcases



27
28
29
# File 'lib/feed_tools/vendor/html5/tests/preamble.rb', line 27

def convertTreeDump(treedump)
  treedump.split(/\n/)[1..-1].map { |line| (line.length > 2 and line[0] == ?|) ? line[3..-1] : line }.join("\n")
end

#sortattrs(output) ⇒ Object



31
32
33
34
35
# File 'lib/feed_tools/vendor/html5/tests/preamble.rb', line 31

def sortattrs(output)
  output.gsub(/^(\s+)\w+=.*(\n\1\w+=.*)+/) do |match|
     match.split("\n").sort.join("\n")
  end
end