From df4e2bc7f7d8238f56e2d823aea707bfd860ad8f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 1 Apr 2012 00:28:15 +0200 Subject: here come the white-space nazis --- test/unit/html.rb | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/unit/html.rb b/test/unit/html.rb index f6e3d7e..cc4a0c6 100644 --- a/test/unit/html.rb +++ b/test/unit/html.rb @@ -2,36 +2,35 @@ require 'test/unit' require 'coderay' class HtmlTest < Test::Unit::TestCase - + def test_independent_lines_option - snippets = {} - + snippets[:ruby] = {} - + snippets[:ruby][:in] = <<-RUBY ruby_inside = <<-RUBY_INSIDE This is tricky, isn't it? RUBY_INSIDE - RUBY - + RUBY + snippets[:ruby][:expected_with_option_off] = <<-HTML_OPT_INDEPENDENT_LINES_OFF ruby_inside = <<-RUBY_INSIDE This is tricky, isn't it? RUBY_INSIDE - HTML_OPT_INDEPENDENT_LINES_OFF - + HTML_OPT_INDEPENDENT_LINES_OFF + snippets[:ruby][:expected_with_option_on] = <<-HTML_OPT_INDEPENDENT_LINES_ON ruby_inside = <<-RUBY_INSIDE This is tricky, isn't it? RUBY_INSIDE - HTML_OPT_INDEPENDENT_LINES_ON - + HTML_OPT_INDEPENDENT_LINES_ON + snippets[:java] = {} - + snippets[:java][:in] = <<-JAVA import java.lang.*; @@ -51,8 +50,8 @@ public class Test { System.out.println(MESSAGE); } } - JAVA - + JAVA + snippets[:java][:expected_with_option_off] = <<-HTML_OPT_INDEPENDENT_LINES_OFF import java.lang.*; @@ -71,8 +70,8 @@ public class Test { System.out.println(MESSAGE); } } - HTML_OPT_INDEPENDENT_LINES_OFF - + HTML_OPT_INDEPENDENT_LINES_OFF + snippets[:java][:expected_with_option_on] = <<-HTML_OPT_INDEPENDENT_LINES_ON import java.lang.*; @@ -91,14 +90,14 @@ public class Test { System.out.println(MESSAGE); } } - HTML_OPT_INDEPENDENT_LINES_ON - - snippets.entries().each do |lang, code| + HTML_OPT_INDEPENDENT_LINES_ON + + for lang, code in snippets tokens = CodeRay.scan code[:in], lang - + assert_equal code[:expected_with_option_off], tokens.html assert_equal code[:expected_with_option_off], tokens.html(:independent_lines => false) assert_equal code[:expected_with_option_on], tokens.html(:independent_lines => true) end end -end \ No newline at end of file +end -- cgit v1.2.1