Fixed that the tests weren't really working

git-svn-id: svn://hamptoncatlin.com/haml/trunk@38 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
packagethief 2006-09-12 15:34:30 +00:00
parent b1836525a8
commit c72a422799
8 changed files with 31 additions and 23 deletions

View File

@ -130,7 +130,7 @@ module Haml #:nodoc:
attributes = parse_class_and_id(attributes.to_s)
attributes.merge!(template_eval(attributes_hash)) unless (attributes_hash.nil? || attributes_hash.empty?)
if action == '\/'
if action == '/'
atomic_tag(tag_name, attributes)
elsif action == '=' || action == '~'
value = template_eval(value)

View File

@ -26,8 +26,9 @@ class HamlTest < Test::Unit::TestCase
end
def assert_renders_correctly(name)
load_result(name).scan(/\n/).zip(@base.render(name).scan(/\n/)).each do |pair|
load_result(name).split("\n").zip(@base.render(name).split("\n")).each do |pair|
assert_equal(pair.first, pair.last)
#puts pair.inspect
end
end
@ -48,6 +49,7 @@ class HamlTest < Test::Unit::TestCase
assert_renders_correctly("helpers")
assert_renders_correctly("whitespace_handling")
assert_renders_correctly("original_engine")
assert_renders_correctly("list")
end
def test_instance_variables

View File

@ -1,2 +1 @@
&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;
Hello&#x000A;nextline

11
test/results/list.xhtml Normal file
View File

@ -0,0 +1,11 @@
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
<li>g</li>
<li>h</li>
<li>i</li>
</ul>

View File

@ -7,12 +7,7 @@
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit
</p>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
<p style='color:green' class='foo'>Cigarettes!</p>
<p class='foo' style='color:green'>Cigarettes!</p>
<h2>Man alive!</h2>
<ul class='things'>
<li>Slippers</li>

View File

@ -1,2 +1 @@
= h("&&&&&&&&&&&") #this is an ActionView Helper... should load
= ("Hello\nnextline") #a haml helper

11
test/templates/list.haml Normal file
View File

@ -0,0 +1,11 @@
%ul
%li a
%li b
%li c
%li d
%li e
%li f
%li g
%li h
%li i

View File

@ -5,22 +5,13 @@
#content
%h1 This is a title!
%p Lorem ipsum dolor sit amet, consectetur adipisicing elit
%ul
%li one
%li two
%li three
%p{ :class => 'foo', :style => 'color:green' } Cigarettes!
%h2 Man alive
%h2 Man alive!
%ul.things
%li Slippers
%li Shoes
%li Bathrobe
%li Coffee
%pre
This is some text that's in a pre block!
Let's see what happens when it's rendered! What about now, since we're on a new line?
%pre
This is some text that's in a pre block!
Let's see what happens when it's rendered! What about now, since we're on a new line?