From 9717dbb394d9a6ab0edced0a3493abf02aae0f0f Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 27 Jul 2021 21:08:07 -0700 Subject: [PATCH] Fix corrupted conversion results a bit Because this code was testing Hamlit's behavior using Haml, we cannot test Haml with Haml here anymore. We probably need to re-generate the spec. --- test/haml/haml-spec/ugly_test.rb | 563 +++++++++++++------------------ 1 file changed, 233 insertions(+), 330 deletions(-) diff --git a/test/haml/haml-spec/ugly_test.rb b/test/haml/haml-spec/ugly_test.rb index 33328b37..d3155854 100644 --- a/test/haml/haml-spec/ugly_test.rb +++ b/test/haml/haml-spec/ugly_test.rb @@ -7,426 +7,382 @@ require 'minitest/autorun' # This is a spec converted by haml-spec. # See: https://github.com/haml/haml-spec class UglyTest < MiniTest::Test - HAML_DEFAULT_OPTIONS = { escape_html: true, escape_attrs: true }.freeze - HAMLIT_DEFAULT_OPTIONS = { escape_html: true }.freeze + HAML_DEFAULT_OPTIONS = { escape_html: true }.freeze def self.haml_result(haml, options, locals) - Haml::Engine.new(haml, HAML_DEFAULT_OPTIONS.merge(options)).render(Object.new, locals) - end - - def self.haml_result(haml, options, locals) - Haml::Template.new(HAMLIT_DEFAULT_OPTIONS.merge(options)) { haml }.render(Object.new, locals) + Haml::Template.new(HAML_DEFAULT_OPTIONS.merge(options)) { haml }.render(Object.new, locals).rstrip end class Headers < MiniTest::Test def test_an_XHTML_XML_prolog haml = %q{!!! XML} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_XHTML_default_transitional_doctype haml = %q{!!!} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_XHTML_1_1_doctype haml = %q{!!! 1.1} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_XHTML_1_2_mobile_doctype haml = %q{!!! mobile} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_XHTML_1_1_basic_doctype haml = %q{!!! basic} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_XHTML_1_0_frameset_doctype haml = %q{!!! frameset} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_an_HTML_5_doctype_with_XHTML_syntax + def test_an_html_5_doctype_with_XHTML_syntax haml = %q{!!! 5} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_an_HTML_5_XML_prolog_silent_ + def test_an_html_5_XML_prolog_silent_ haml = %q{!!! XML} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_HTML_5_doctype haml = %q{!!!} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_HTML_4_XML_prolog_silent_ haml = %q{!!! XML} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html4} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_HTML_4_default_transitional_doctype haml = %q{!!!} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html4} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_HTML_4_frameset_doctype haml = %q{!!! frameset} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html4} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_HTML_4_strict_doctype haml = %q{!!! strict} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html4} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Basichamltagsandcss < MiniTest::Test def test_a_simple_Haml_tag haml = %q{%p} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_self_closing_tag_XHTML_ haml = %q{%meta} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_self_closing_tag_HTML4_ haml = %q{%meta} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html4} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_self_closing_tag_HTML5_ haml = %q{%meta} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_self_closing_tag_modifier_XHTML_ haml = %q{%zzz/} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_a_self_closing_tag_modifier_HTML5_ + def test_a_self_closing_tag_modifier_html5_ haml = %q{%zzz/} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_a_CSS_class haml = %q{%p.class1} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_multiple_CSS_classes haml = %q{%p.class1.class2} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_a_CSS_id haml = %q{%p#id1} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_multiple_CSS_id_s haml = %q{%p#id1#id2} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_a_class_followed_by_an_id haml = %q{%p.class1#id1} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_an_id_followed_by_a_class haml = %q{%p#id1.class1} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_implicit_div_with_a_CSS_id haml = %q{#id1} - _html = %q{
} + html = %q{
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_an_implicit_div_with_a_CSS_class haml = %q{.class1} - _html = %q{
} + html = %q{
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_multiple_simple_Haml_tags haml = %q{%div %div %p} - _html = %q{
-
-

-
+ html = %q{
+
+

+
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Tagswithunusualhtmlcharacters < MiniTest::Test def test_a_tag_with_colons haml = %q{%ns:tag} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_underscores haml = %q{%snake_case} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_dashes haml = %q{%dashed-tag} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_camelCase haml = %q{%camelCase} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_PascalCase haml = %q{%PascalCase} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Tagswithunusualcssidentifiers < MiniTest::Test def test_an_all_numeric_class haml = %q{.123} - _html = %q{
} + html = %q{
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_class_with_underscores haml = %q{.__} - _html = %q{
} + html = %q{
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_class_with_dashes haml = %q{.--} - _html = %q{
} + html = %q{
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Tagswithinlinecontent < MiniTest::Test def test_Inline_content_simple_tag haml = %q{%p hello} - _html = %q{

hello

} + html = %q{

hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Inline_content_tag_with_CSS haml = %q{%p.class1 hello} - _html = %q{

hello

} + html = %q{

hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Inline_content_multiple_simple_tags haml = %q{%div %div %p text} - _html = %q{
-
-

text

-
+ html = %q{
+
+

text

+
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end @@ -434,27 +390,25 @@ class UglyTest < MiniTest::Test def test_Nested_content_simple_tag haml = %q{%p hello} - _html = %q{

- hello + html = %q{

+hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Nested_content_tag_with_CSS haml = %q{%p.class1 hello} - _html = %q{

- hello + html = %q{

+hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Nested_content_multiple_simple_tags @@ -462,349 +416,319 @@ class UglyTest < MiniTest::Test %div %p text} - _html = %q{
-
-

- text -

-
+ html = %q{
+
+

+text +

+
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Tagswithhtmlstyleattributes < MiniTest::Test - def test_HTML_style_one_attribute + def test_html_style_one_attribute haml = %q{%p(a='b')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_multiple_attributes + def test_html_style_multiple_attributes haml = %q{%p(a='b' c='d')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_attributes_separated_with_newlines + def test_html_style_attributes_separated_with_newlines haml = %q{%p(a='b' c='d')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_interpolated_attribute + def test_html_style_interpolated_attribute haml = %q{%p(a="#{var}")} - _html = %q{

} + html = %q{

} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_class_as_an_attribute + def test_html_style_class_as_an_attribute haml = %q{%p(class='class1')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_a_CSS_class_and_class_as_an_attribute + def test_html_style_tag_with_a_CSS_class_and_class_as_an_attribute haml = %q{%p.class2(class='class1')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_id_as_an_attribute + def test_html_style_tag_with_id_as_an_attribute haml = %q{%p(id='1')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_a_CSS_id_and_id_as_an_attribute + def test_html_style_tag_with_a_CSS_id_and_id_as_an_attribute haml = %q{%p#id(id='1')} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_a_variable_attribute + def test_html_style_tag_with_a_variable_attribute haml = %q{%p(class=var)} - _html = %q{

} + html = %q{

} locals = {:var=>"hello"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute + def test_html_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute haml = %q{.hello(class=var)} - _html = %q{
} + html = %q{
} locals = {:var=>"world"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_multiple_CSS_classes_sorted_correctly_ + def test_html_style_tag_multiple_CSS_classes_sorted_correctly_ + skip 'This test is probably not compatible with Haml 5. So the test is outdated.' haml = %q{.z(class=var)} - _html = %q{
} + html = %q{
} locals = {:var=>"a"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_HTML_style_tag_with_an_atomic_attribute + def test_html_style_tag_with_an_atomic_attribute skip '[INCOMPATIBILITY] Haml limits boolean attributes' haml = %q{%a(flag)} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Tagswithrubystyleattributes < MiniTest::Test def test_Ruby_style_one_attribute haml = %q{%p{:a => 'b'}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_attributes_hash_with_whitespace haml = %q{%p{ :a => 'b' }} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_interpolated_attribute haml = %q{%p{:a =>"#{var}"}} - _html = %q{

} + html = %q{

} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_multiple_attributes haml = %q{%p{ :a => 'b', 'c' => 'd' }} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_attributes_separated_with_newlines haml = %q{%p{ :a => 'b', 'c' => 'd' }} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_class_as_an_attribute haml = %q{%p{:class => 'class1'}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_a_CSS_class_and_class_as_an_attribute haml = %q{%p.class2{:class => 'class1'}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_id_as_an_attribute haml = %q{%p{:id => '1'}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_a_CSS_id_and_id_as_an_attribute haml = %q{%p#id{:id => '1'}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_a_CSS_id_and_a_numeric_id_as_an_attribute haml = %q{%p#id{:id => 1}} - _html = %q{

} + html = %q{

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_a_variable_attribute haml = %q{%p{:class => var}} - _html = %q{

} + html = %q{

} locals = {:var=>"hello"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute haml = %q{.hello{:class => var}} - _html = %q{
} + html = %q{
} locals = {:var=>"world"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_Ruby_style_tag_multiple_CSS_classes_sorted_correctly_ + skip 'This test is probably not compatible with Haml 5. So the test is outdated.' haml = %q{.z{:class => var}} - _html = %q{
} + html = %q{
} locals = {:var=>"a"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Silentcomments < MiniTest::Test def test_an_inline_silent_comment haml = %q{-# hello} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_nested_silent_comment haml = %q{-# hello} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_multiply_nested_silent_comment haml = %q{-# %div foo} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_multiply_nested_silent_comment_with_inconsistent_indents haml = %q{-# %div foo} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Markupcomments < MiniTest::Test def test_an_inline_markup_comment haml = %q{/ comment} - _html = %q{} + html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_nested_markup_comment haml = %q{/ comment comment2} - _html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end @@ -812,14 +736,13 @@ class UglyTest < MiniTest::Test def test_a_conditional_comment haml = %q{/[if IE] %p a} - _html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end @@ -827,12 +750,11 @@ class UglyTest < MiniTest::Test def test_content_in_an_escaped_filter haml = %q{:escaped <&">} - _html = %q{<&">} + html = %q{<&">} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_content_in_a_preserve_filter @@ -840,13 +762,12 @@ class UglyTest < MiniTest::Test hello %p} - _html = %q{hello + html = %q{hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_content_in_a_plain_filter @@ -854,13 +775,12 @@ class UglyTest < MiniTest::Test hello %p} - _html = %q{hello + html = %q{hello

} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_content_in_a_css_filter_XHTML_ @@ -868,7 +788,7 @@ class UglyTest < MiniTest::Test hello %p} - _html = %q{

} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_content_in_a_javascript_filter_HTML_ + def test_content_in_a_javascript_filter_html_ haml = %q{:javascript a(); %p} - _html = %q{

} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Rubystyleinterpolation < MiniTest::Test def test_interpolation_inside_inline_content haml = %q{%p #{var}} - _html = %q{

value

} + html = %q{

value

} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_no_interpolation_when_escaped haml = %q{%p \#{var}} - _html = %q{

#{var}

} + html = %q{

#{var}

} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_interpolation_when_the_escape_character_is_escaped + skip 'This test is probably not compatible with Haml 5. So the test is outdated.' haml = %q{%p \\#{var}} - _html = %q{

\value

} + html = %q{

\value

} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_interpolation_inside_filtered_content haml = %q{:plain #{var} interpolated: #{var}} - _html = %q{value interpolated: value} + html = %q{value interpolated: value} locals = {:var=>"value"} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Htmlescaping < MiniTest::Test def test_code_following_ haml = %q{&= '<"&>'} - _html = %q{<"&>} + html = %q{<"&>} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_code_following_eq_when_escape_haml_is_set_to_true haml = %q{= '<"&>'} - _html = %q{<"&>} + html = %q{<"&>} locals = {} options = {:escape_html=>"true"} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_code_following_neq_when_escape_haml_is_set_to_true haml = %q{!= '<"&>'} - _html = %q{<"&>} + html = %q{<"&>} locals = {} options = {:escape_html=>"true"} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Booleanattributes < MiniTest::Test def test_boolean_attribute_with_XHTML haml = %q{%input(checked=true)} - _html = %q{} + html = %q{} locals = {} options = {:format=>:xhtml} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end - def test_boolean_attribute_with_HTML + def test_boolean_attribute_withhtml haml = %q{%input(checked=true)} - _html = %q{} + html = %q{} locals = {} options = {:format=>:html5} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end class Whitespacepreservation < MiniTest::Test def test_following_the_operator + skip 'This test is probably not compatible with Haml 5. So the test is outdated.' haml = %q{~ "Foo\n
Bar\nBaz
"} - _html = %q{Foo + html = %q{Foo
Bar
Baz
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_inside_a_textarea_tag haml = %q{%textarea hello hello} - _html = %q{} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_inside_a_pre_tag haml = %q{%pre hello hello} - _html = %q{
hello
+      html    = %q{
hello
 hello
} locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end @@ -1071,12 +977,11 @@ hello
} haml = %q{%li hello %li> world %li again} - _html = %q{
  • hello
  • world
  • again
  • } + html = %q{
  • hello
  • world
  • again
  • } locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_appended_and_nested_content @@ -1084,27 +989,25 @@ hello} %li> world %li again} - _html = %q{
  • hello
  • - world + html = %q{
  • hello
  • +world
  • again
  • } locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end def test_a_tag_with_appended haml = %q{%p< hello world} - _html = %q{

    hello + html = %q{

    hello world

    } locals = {} options = {} haml_result = UglyTest.haml_result(haml, options, locals) - haml_result = UglyTest.haml_result(haml, options, locals) - assert_equal haml_result, haml_result + assert_equal html, haml_result end end end if RUBY_ENGINE != 'truffleruby' # truffleruby cannot run Haml