From c999deb1e932b3290561a58923603eb87809c8df Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 13 Jun 2016 01:03:13 +0200 Subject: fix tests --- test/functional/examples.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/functional/examples.rb') diff --git a/test/functional/examples.rb b/test/functional/examples.rb index 8da4fc7..49337cb 100755 --- a/test/functional/examples.rb +++ b/test/functional/examples.rb @@ -5,10 +5,14 @@ require 'coderay' class ExamplesTest < Test::Unit::TestCase + def normalize_html html + html.gsub(''', "'").gsub('"', '"') + end + def test_examples # output as HTML div (using inline CSS styles) div = CodeRay.scan('puts "Hello, world!"', :ruby).div - assert_equal <<-DIV, div + assert_equal <<-DIV, normalize_html(div)
puts "Hello, world!"
@@ -20,7 +24,7 @@ class ExamplesTest < Test::Unit::TestCase puts 'Hello, world!' end CODE - assert_equal <<-DIV, div + assert_equal <<-DIV, normalize_html(div)
1
 2
@@ -34,7 +38,7 @@ end
     
     # output as standalone HTML page (using CSS classes)
     page = CodeRay.scan('puts "Hello, world!"', :ruby).page
-    assert_match <<-PAGE, page
+    assert_match <<-PAGE, normalize_html(page)
 
 
 
@@ -90,7 +94,7 @@ Token Types (7):
     
     # produce a HTML div, but with CSS classes
     div = tokens.div(:css => :class)
-    assert_equal <<-DIV, div
+    assert_equal <<-DIV, normalize_html(div)
 
{ "just": "an", "example": 42 }
@@ -119,7 +123,7 @@ Token Types (7): # re-using scanner and encoder ruby_highlighter = CodeRay::Duo[:ruby, :div] div = ruby_highlighter.encode('puts "Hello, world!"') - assert_equal <<-DIV, div + assert_equal <<-DIV, normalize_html(div)
puts "Hello, world!"
-- cgit v1.2.1