mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Generate all tests and ignore failing tests
This commit is contained in:
parent
2f7b6c71d5
commit
37a9ddc4ff
3 changed files with 367 additions and 136 deletions
|
@ -5,7 +5,7 @@ require 'unindent'
|
|||
require 'open-uri'
|
||||
|
||||
def escape_name(name, replacer)
|
||||
name.gsub(/[\s\-\(\)\.\.+'\/<>]+/, replacer)
|
||||
name.gsub(/[\s\-\(\)\.\.+'\/<>&=~]+/, replacer)
|
||||
end
|
||||
|
||||
def generate_spec(mode)
|
||||
|
|
|
@ -109,9 +109,9 @@ basic Haml tags and CSS:
|
|||
a tag with a class followed by an id:
|
||||
haml: "%p.class1#id1"
|
||||
html: "<p class='class1' id='id1'></p>"
|
||||
# a tag with an id followed by a class:
|
||||
# haml: "%p#id1.class1"
|
||||
# html: "<p class='class1' id='id1'></p>"
|
||||
a tag with an id followed by a class:
|
||||
haml: "%p#id1.class1"
|
||||
html: "<p class='class1' id='id1'></p>"
|
||||
an implicit div with a CSS id:
|
||||
haml: "#id1"
|
||||
html: "<div id='id1'></div>"
|
||||
|
@ -238,19 +238,19 @@ tags with HTML-style attributes:
|
|||
html: "<p class='hello'></p>"
|
||||
locals:
|
||||
var: hello
|
||||
# HTML-style tag with a CSS class and 'class' as a variable attribute:
|
||||
# haml: ".hello(class=var)"
|
||||
# html: "<div class='hello world'></div>"
|
||||
# locals:
|
||||
# var: world
|
||||
# HTML-style tag multiple CSS classes (sorted correctly):
|
||||
# haml: ".z(class=var)"
|
||||
# html: "<div class='a z'></div>"
|
||||
# locals:
|
||||
# var: a
|
||||
# HTML-style tag with an atomic attribute:
|
||||
# haml: "%a(flag)"
|
||||
# html: "<a flag></a>"
|
||||
HTML-style tag with a CSS class and 'class' as a variable attribute:
|
||||
haml: ".hello(class=var)"
|
||||
html: "<div class='hello world'></div>"
|
||||
locals:
|
||||
var: world
|
||||
HTML-style tag multiple CSS classes (sorted correctly):
|
||||
haml: ".z(class=var)"
|
||||
html: "<div class='a z'></div>"
|
||||
locals:
|
||||
var: a
|
||||
HTML-style tag with an atomic attribute:
|
||||
haml: "%a(flag)"
|
||||
html: "<a flag></a>"
|
||||
tags with Ruby-style attributes:
|
||||
Ruby-style one attribute:
|
||||
haml: "%p{:a => 'b'}"
|
||||
|
@ -292,28 +292,28 @@ tags with Ruby-style attributes:
|
|||
haml: "%p#id{:id => '1'}"
|
||||
html: "<p id='id_1'></p>"
|
||||
optional: true
|
||||
# Ruby-style tag with a CSS id and a numeric 'id' as an attribute:
|
||||
# haml: "%p#id{:id => 1}"
|
||||
# html: "<p id='id_1'></p>"
|
||||
# optional: true
|
||||
Ruby-style tag with a CSS id and a numeric 'id' as an attribute:
|
||||
haml: "%p#id{:id => 1}"
|
||||
html: "<p id='id_1'></p>"
|
||||
optional: true
|
||||
Ruby-style tag with a variable attribute:
|
||||
haml: "%p{:class => var}"
|
||||
html: "<p class='hello'></p>"
|
||||
optional: true
|
||||
locals:
|
||||
var: hello
|
||||
# Ruby-style tag with a CSS class and 'class' as a variable attribute:
|
||||
# haml: ".hello{:class => var}"
|
||||
# html: "<div class='hello world'></div>"
|
||||
# optional: true
|
||||
# locals:
|
||||
# var: world
|
||||
# Ruby-style tag multiple CSS classes (sorted correctly):
|
||||
# haml: ".z{:class => var}"
|
||||
# html: "<div class='a z'></div>"
|
||||
# optional: true
|
||||
# locals:
|
||||
# var: a
|
||||
Ruby-style tag with a CSS class and 'class' as a variable attribute:
|
||||
haml: ".hello{:class => var}"
|
||||
html: "<div class='hello world'></div>"
|
||||
optional: true
|
||||
locals:
|
||||
var: world
|
||||
Ruby-style tag multiple CSS classes (sorted correctly):
|
||||
haml: ".z{:class => var}"
|
||||
html: "<div class='a z'></div>"
|
||||
optional: true
|
||||
locals:
|
||||
var: a
|
||||
silent comments:
|
||||
an inline silent comment:
|
||||
haml: "-# hello"
|
||||
|
@ -349,30 +349,30 @@ markup comments:
|
|||
comment
|
||||
comment2
|
||||
-->
|
||||
# conditional comments:
|
||||
# a conditional comment:
|
||||
# haml: |-
|
||||
# /[if IE]
|
||||
# %p a
|
||||
# html: |-
|
||||
# <!--[if IE]>
|
||||
# <p>a</p>
|
||||
# <![endif]-->
|
||||
# internal filters:
|
||||
# content in an 'escaped' filter:
|
||||
# haml: |-
|
||||
# :escaped
|
||||
# <&">
|
||||
# html: "<&">"
|
||||
# content in a 'preserve' filter:
|
||||
# haml: |-
|
||||
# :preserve
|
||||
# hello
|
||||
#
|
||||
# %p
|
||||
# html: |-
|
||||
# hello

|
||||
# <p></p>
|
||||
conditional comments:
|
||||
a conditional comment:
|
||||
haml: |-
|
||||
/[if IE]
|
||||
%p a
|
||||
html: |-
|
||||
<!--[if IE]>
|
||||
<p>a</p>
|
||||
<![endif]-->
|
||||
internal filters:
|
||||
content in an 'escaped' filter:
|
||||
haml: |-
|
||||
:escaped
|
||||
<&">
|
||||
html: "<&">"
|
||||
content in a 'preserve' filter:
|
||||
haml: |-
|
||||
:preserve
|
||||
hello
|
||||
|
||||
%p
|
||||
html: |-
|
||||
hello

|
||||
<p></p>
|
||||
content in a 'plain' filter:
|
||||
haml: |-
|
||||
:plain
|
||||
|
@ -382,60 +382,60 @@ markup comments:
|
|||
html: |-
|
||||
hello
|
||||
<p></p>
|
||||
# content in a 'css' filter (XHTML):
|
||||
# haml: |-
|
||||
# :css
|
||||
# hello
|
||||
#
|
||||
# %p
|
||||
# html: |-
|
||||
# <style type='text/css'>
|
||||
# /*<![CDATA[*/
|
||||
# hello
|
||||
# /*]]>*/
|
||||
# </style>
|
||||
# <p></p>
|
||||
# config:
|
||||
# format: xhtml
|
||||
# content in a 'javascript' filter (XHTML):
|
||||
# haml: |-
|
||||
# :javascript
|
||||
# a();
|
||||
# %p
|
||||
# html: |-
|
||||
# <script type='text/javascript'>
|
||||
# //<![CDATA[
|
||||
# a();
|
||||
# //]]>
|
||||
# </script>
|
||||
# <p></p>
|
||||
# config:
|
||||
# format: xhtml
|
||||
# content in a 'css' filter (HTML):
|
||||
# haml: |-
|
||||
# :css
|
||||
# hello
|
||||
#
|
||||
# %p
|
||||
# html: |-
|
||||
# <style>
|
||||
# hello
|
||||
# </style>
|
||||
# <p></p>
|
||||
# config:
|
||||
# format: html5
|
||||
# content in a 'javascript' filter (HTML):
|
||||
# haml: |-
|
||||
# :javascript
|
||||
# a();
|
||||
# %p
|
||||
# html: |-
|
||||
# <script>
|
||||
# a();
|
||||
# </script>
|
||||
# <p></p>
|
||||
# config:
|
||||
# format: html5
|
||||
content in a 'css' filter (XHTML):
|
||||
haml: |-
|
||||
:css
|
||||
hello
|
||||
|
||||
%p
|
||||
html: |-
|
||||
<style type='text/css'>
|
||||
/*<![CDATA[*/
|
||||
hello
|
||||
/*]]>*/
|
||||
</style>
|
||||
<p></p>
|
||||
config:
|
||||
format: xhtml
|
||||
content in a 'javascript' filter (XHTML):
|
||||
haml: |-
|
||||
:javascript
|
||||
a();
|
||||
%p
|
||||
html: |-
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
a();
|
||||
//]]>
|
||||
</script>
|
||||
<p></p>
|
||||
config:
|
||||
format: xhtml
|
||||
content in a 'css' filter (HTML):
|
||||
haml: |-
|
||||
:css
|
||||
hello
|
||||
|
||||
%p
|
||||
html: |-
|
||||
<style>
|
||||
hello
|
||||
</style>
|
||||
<p></p>
|
||||
config:
|
||||
format: html5
|
||||
content in a 'javascript' filter (HTML):
|
||||
haml: |-
|
||||
:javascript
|
||||
a();
|
||||
%p
|
||||
html: |-
|
||||
<script>
|
||||
a();
|
||||
</script>
|
||||
<p></p>
|
||||
config:
|
||||
format: html5
|
||||
Ruby-style interpolation:
|
||||
interpolation inside inline content:
|
||||
haml: "%p #{var}"
|
||||
|
@ -463,38 +463,38 @@ Ruby-style interpolation:
|
|||
optional: true
|
||||
locals:
|
||||
var: value
|
||||
# HTML escaping:
|
||||
# code following '&=':
|
||||
# haml: '&= ''<"&>'''
|
||||
# html: "<"&>"
|
||||
# code following '=' when escape_haml is set to true:
|
||||
# haml: = '<"&>'
|
||||
# html: "<"&>"
|
||||
# config:
|
||||
# escape_html: 'true'
|
||||
# code following '!=' when escape_haml is set to true:
|
||||
# haml: '!= ''<"&>'''
|
||||
# html: <"&>
|
||||
# config:
|
||||
# escape_html: 'true'
|
||||
HTML escaping:
|
||||
code following '&=':
|
||||
haml: '&= ''<"&>'''
|
||||
html: "<"&>"
|
||||
code following '=' when escape_haml is set to true:
|
||||
haml: = '<"&>'
|
||||
html: "<"&>"
|
||||
config:
|
||||
escape_html: 'true'
|
||||
code following '!=' when escape_haml is set to true:
|
||||
haml: '!= ''<"&>'''
|
||||
html: <"&>
|
||||
config:
|
||||
escape_html: 'true'
|
||||
boolean attributes:
|
||||
# boolean attribute with XHTML:
|
||||
# haml: "%input(checked=true)"
|
||||
# html: "<input checked='checked' />"
|
||||
# config:
|
||||
# format: xhtml
|
||||
boolean attribute with XHTML:
|
||||
haml: "%input(checked=true)"
|
||||
html: "<input checked='checked' />"
|
||||
config:
|
||||
format: xhtml
|
||||
boolean attribute with HTML:
|
||||
haml: "%input(checked=true)"
|
||||
html: "<input checked>"
|
||||
config:
|
||||
format: html5
|
||||
whitespace preservation:
|
||||
# following the '~' operator:
|
||||
# haml: ~ "Foo\n<pre>Bar\nBaz</pre>"
|
||||
# html: |-
|
||||
# Foo
|
||||
# <pre>Bar
Baz</pre>
|
||||
# optional: true
|
||||
following the '~' operator:
|
||||
haml: ~ "Foo\n<pre>Bar\nBaz</pre>"
|
||||
html: |-
|
||||
Foo
|
||||
<pre>Bar
Baz</pre>
|
||||
optional: true
|
||||
inside a textarea tag:
|
||||
haml: |-
|
||||
%textarea
|
||||
|
|
|
@ -257,6 +257,16 @@ class UglyTest < MiniTest::Test
|
|||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_a_tag_with_an_id_followed_by_a_class
|
||||
haml = %q{%p#id1.class1}
|
||||
html = %q{<p class='class1' id='id1'></p>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def test_an_implicit_div_with_a_CSS_id
|
||||
haml = %q{#id1}
|
||||
html = %q{<div id='id1'></div>}
|
||||
|
@ -554,6 +564,36 @@ class UglyTest < MiniTest::Test
|
|||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_HTML_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute
|
||||
haml = %q{.hello(class=var)}
|
||||
html = %q{<div class='hello world'></div>}
|
||||
locals = {:var=>"world"}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_HTML_style_tag_multiple_CSS_classes_sorted_correctly_
|
||||
haml = %q{.z(class=var)}
|
||||
html = %q{<div class='a z'></div>}
|
||||
locals = {:var=>"a"}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_HTML_style_tag_with_an_atomic_attribute
|
||||
haml = %q{%a(flag)}
|
||||
html = %q{<a flag></a>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Tagswithrubystyleattributes < MiniTest::Test
|
||||
|
@ -648,6 +688,16 @@ class UglyTest < MiniTest::Test
|
|||
assert_equal haml_result, hamlit_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{<p id='id_1'></p>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def test_Ruby_style_tag_with_a_variable_attribute
|
||||
haml = %q{%p{:class => var}}
|
||||
html = %q{<p class='hello'></p>}
|
||||
|
@ -657,6 +707,26 @@ class UglyTest < MiniTest::Test
|
|||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_Ruby_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute
|
||||
haml = %q{.hello{:class => var}}
|
||||
html = %q{<div class='hello world'></div>}
|
||||
locals = {:var=>"world"}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_Ruby_style_tag_multiple_CSS_classes_sorted_correctly_
|
||||
haml = %q{.z{:class => var}}
|
||||
html = %q{<div class='a z'></div>}
|
||||
locals = {:var=>"a"}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Silentcomments < MiniTest::Test
|
||||
|
@ -731,6 +801,48 @@ class UglyTest < MiniTest::Test
|
|||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Conditionalcomments < MiniTest::Test
|
||||
def _test_a_conditional_comment
|
||||
haml = %q{/[if IE]
|
||||
%p a}
|
||||
html = %q{<!--[if IE]>
|
||||
<p>a</p>
|
||||
<![endif]-->}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Internalfilters < MiniTest::Test
|
||||
def _test_content_in_an_escaped_filter
|
||||
haml = %q{:escaped
|
||||
<&">}
|
||||
html = %q{<&">}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_content_in_a_preserve_filter
|
||||
haml = %q{:preserve
|
||||
hello
|
||||
|
||||
%p}
|
||||
html = %q{hello

|
||||
<p></p>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def test_content_in_a_plain_filter
|
||||
haml = %q{:plain
|
||||
|
@ -745,6 +857,72 @@ class UglyTest < MiniTest::Test
|
|||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_content_in_a_css_filter_XHTML_
|
||||
haml = %q{:css
|
||||
hello
|
||||
|
||||
%p}
|
||||
html = %q{<style type='text/css'>
|
||||
/*<![CDATA[*/
|
||||
hello
|
||||
/*]]>*/
|
||||
</style>
|
||||
<p></p>}
|
||||
locals = {}
|
||||
options = {:format=>:xhtml}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_content_in_a_javascript_filter_XHTML_
|
||||
haml = %q{:javascript
|
||||
a();
|
||||
%p}
|
||||
html = %q{<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
a();
|
||||
//]]>
|
||||
</script>
|
||||
<p></p>}
|
||||
locals = {}
|
||||
options = {:format=>:xhtml}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_content_in_a_css_filter_HTML_
|
||||
haml = %q{:css
|
||||
hello
|
||||
|
||||
%p}
|
||||
html = %q{<style>
|
||||
hello
|
||||
</style>
|
||||
<p></p>}
|
||||
locals = {}
|
||||
options = {:format=>:html5}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_content_in_a_javascript_filter_HTML_
|
||||
haml = %q{:javascript
|
||||
a();
|
||||
%p}
|
||||
html = %q{<script>
|
||||
a();
|
||||
</script>
|
||||
<p></p>}
|
||||
locals = {}
|
||||
options = {:format=>:html5}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Rubystyleinterpolation < MiniTest::Test
|
||||
|
@ -790,7 +968,49 @@ class UglyTest < MiniTest::Test
|
|||
end
|
||||
end
|
||||
|
||||
class Htmlescaping < MiniTest::Test
|
||||
def _test_code_following_
|
||||
haml = %q{&= '<"&>'}
|
||||
html = %q{<"&>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_code_following_when_escape_haml_is_set_to_true
|
||||
haml = %q{= '<"&>'}
|
||||
html = %q{<"&>}
|
||||
locals = {}
|
||||
options = {:escape_html=>"true"}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def _test_code_following_!_when_escape_haml_is_set_to_true
|
||||
haml = %q{!= '<"&>'}
|
||||
html = %q{<"&>}
|
||||
locals = {}
|
||||
options = {:escape_html=>"true"}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
end
|
||||
|
||||
class Booleanattributes < MiniTest::Test
|
||||
def _test_boolean_attribute_with_XHTML
|
||||
haml = %q{%input(checked=true)}
|
||||
html = %q{<input checked='checked' />}
|
||||
locals = {}
|
||||
options = {:format=>:xhtml}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def test_boolean_attribute_with_HTML
|
||||
haml = %q{%input(checked=true)}
|
||||
html = %q{<input checked>}
|
||||
|
@ -803,6 +1023,17 @@ class UglyTest < MiniTest::Test
|
|||
end
|
||||
|
||||
class Whitespacepreservation < MiniTest::Test
|
||||
def _test_following_the_operator
|
||||
haml = %q{~ "Foo\n<pre>Bar\nBaz</pre>"}
|
||||
html = %q{Foo
|
||||
<pre>Bar
Baz</pre>}
|
||||
locals = {}
|
||||
options = {}
|
||||
haml_result = UglyTest.haml_result(haml, options, locals)
|
||||
hamlit_result = UglyTest.hamlit_result(haml, options, locals)
|
||||
assert_equal haml_result, hamlit_result
|
||||
end
|
||||
|
||||
def test_inside_a_textarea_tag
|
||||
haml = %q{%textarea
|
||||
hello
|
||||
|
|
Loading…
Reference in a new issue