2006-10-14 19:50:07 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2007-11-18 06:14:12 -05:00
|
|
|
require 'rubygems'
|
|
|
|
require 'active_support'
|
|
|
|
require 'action_controller'
|
|
|
|
require 'action_view'
|
|
|
|
|
2006-06-30 11:14:44 -04:00
|
|
|
require 'test/unit'
|
2006-12-03 18:56:47 -05:00
|
|
|
require File.dirname(__FILE__) + '/../../lib/haml'
|
|
|
|
require 'haml/engine'
|
2006-08-06 00:25:31 -04:00
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
class EngineTest < Test::Unit::TestCase
|
2006-08-05 23:18:54 -04:00
|
|
|
|
2007-11-23 07:14:02 -05:00
|
|
|
def render(text, options = {}, &block)
|
2007-11-24 03:35:10 -05:00
|
|
|
scope = options.delete(:scope) || Object.new
|
|
|
|
locals = options.delete(:locals) || {}
|
|
|
|
Haml::Engine.new(text, options).to_html(scope, locals, &block)
|
2006-08-05 23:18:54 -04:00
|
|
|
end
|
2006-11-04 03:35:06 -05:00
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_empty_render_should_remain_empty
|
|
|
|
assert_equal('', render(''))
|
2006-08-05 23:18:54 -04:00
|
|
|
end
|
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_attributes_should_render_correctly
|
|
|
|
assert_equal("<div class='atlantis' style='ugly'>\n</div>", render(".atlantis{:style => 'ugly'}").chomp)
|
2006-08-05 23:18:54 -04:00
|
|
|
end
|
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_ruby_code_should_work_inside_attributes
|
|
|
|
author = 'hcatlin'
|
|
|
|
assert_equal("<p class='3'>foo</p>", render("%p{:class => 1+2} foo").chomp)
|
2006-08-05 23:18:54 -04:00
|
|
|
end
|
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_nil_should_render_empty_tag
|
|
|
|
assert_equal("<div class='no_attributes'>\n</div>",
|
|
|
|
render(".no_attributes{:nil => nil}").chomp)
|
2006-08-05 23:18:54 -04:00
|
|
|
end
|
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_strings_should_get_stripped_inside_tags
|
|
|
|
assert_equal("<div class='stripped'>This should have no spaces in front of it</div>",
|
|
|
|
render(".stripped This should have no spaces in front of it").chomp)
|
2006-08-09 14:12:54 -04:00
|
|
|
end
|
2006-11-04 03:35:06 -05:00
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_one_liner_should_be_one_line
|
|
|
|
assert_equal("<p>Hello</p>", render('%p Hello').chomp)
|
2006-08-13 18:02:04 -04:00
|
|
|
end
|
2006-08-13 18:10:05 -04:00
|
|
|
|
2006-09-29 14:39:13 -04:00
|
|
|
def test_long_liner_should_not_print_on_one_line
|
|
|
|
assert_equal("<div>\n #{'x' * 51}\n</div>", render("%div #{'x' * 51}").chomp)
|
2006-08-13 18:10:05 -04:00
|
|
|
end
|
2007-07-13 00:39:13 -04:00
|
|
|
|
|
|
|
def test_non_prerendered_one_liner
|
|
|
|
assert_equal("<p class='awesome'>One line</p>\n", render("%p{:class => c} One line", :locals => {:c => 'awesome'}))
|
|
|
|
end
|
2007-07-16 23:48:11 -04:00
|
|
|
|
|
|
|
def test_non_prerendered_script_one_liner
|
|
|
|
assert_equal("<p class='awesome'>One line</p>\n", render("%p{:class => c}= 'One line'", :locals => {:c => 'awesome'}))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_non_prerendered_long_script_one_liner
|
|
|
|
assert_equal("<p class='awesome'>\n #{'x' * 60}\n</p>\n", render("%p{:class => c}= 'x' * 60", :locals => {:c => 'awesome'}))
|
|
|
|
end
|
2006-11-04 03:35:06 -05:00
|
|
|
|
2006-10-27 16:48:40 -04:00
|
|
|
def test_multi_render
|
|
|
|
engine = Haml::Engine.new("%strong Hi there!")
|
|
|
|
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
|
|
|
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
|
|
|
assert_equal("<strong>Hi there!</strong>\n", engine.to_html)
|
|
|
|
end
|
2006-11-04 03:35:06 -05:00
|
|
|
|
2007-05-07 14:16:24 -04:00
|
|
|
def test_double_equals
|
|
|
|
assert_equal("<p>Hello World</p>\n", render('%p== Hello #{who}', :locals => {:who => 'World'}))
|
|
|
|
assert_equal("<p>\n Hello World\n</p>\n", render("%p\n == Hello \#{who}", :locals => {:who => 'World'}))
|
|
|
|
end
|
|
|
|
|
2007-08-11 15:10:28 -04:00
|
|
|
def test_double_equals_in_the_middle_of_a_string
|
|
|
|
assert_equal("\"title 'Title'. \"\n",
|
|
|
|
render("== \"title '\#{\"Title\"}'. \""))
|
|
|
|
end
|
|
|
|
|
2007-08-16 17:49:53 -04:00
|
|
|
def test_nil_tag_value_should_render_as_empty
|
|
|
|
assert_equal("<p></p>\n", render("%p= nil"))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_tag_with_failed_if_should_render_as_empty
|
|
|
|
assert_equal("<p></p>\n", render("%p= 'Hello' if false"))
|
|
|
|
end
|
|
|
|
|
2007-11-22 00:29:26 -05:00
|
|
|
def test_static_attributes_with_empty_attr
|
|
|
|
assert_equal("<img alt='' src='/foo.png' />\n", render("%img{:src => '/foo.png', :alt => ''}"))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_dynamic_attributes_with_empty_attr
|
|
|
|
assert_equal("<img alt='' src='/foo.png' />\n", render("%img{:width => nil, :src => '/foo.png', :alt => String.new}"))
|
|
|
|
end
|
|
|
|
|
2006-11-04 03:35:06 -05:00
|
|
|
# Options tests
|
|
|
|
|
|
|
|
def test_stop_eval
|
|
|
|
assert_equal("", render("= 'Hello'", :suppress_eval => true))
|
2007-04-09 13:03:12 -04:00
|
|
|
assert_equal("", render("- puts 'foo'", :suppress_eval => true))
|
2007-06-02 06:45:24 -04:00
|
|
|
assert_equal("<div id='foo' yes='no' />\n", render("#foo{:yes => 'no'}/", :suppress_eval => true))
|
|
|
|
assert_equal("<div id='foo' />\n", render("#foo{:yes => 'no', :call => a_function() }/", :suppress_eval => true))
|
2007-04-09 13:03:12 -04:00
|
|
|
assert_equal("<div />\n", render("%div[1]/", :suppress_eval => true))
|
2007-03-27 16:24:29 -04:00
|
|
|
|
|
|
|
begin
|
|
|
|
assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true))
|
|
|
|
rescue Haml::HamlError => err
|
|
|
|
caught = true
|
2007-11-25 15:20:44 -05:00
|
|
|
assert_equal('"ruby" filter is not defined!', err.message)
|
2007-03-27 16:24:29 -04:00
|
|
|
end
|
|
|
|
assert(caught, "Rendering a ruby filter without evaluating didn't throw an error!")
|
2006-11-04 03:35:06 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_attr_wrapper
|
|
|
|
assert_equal("<p strange=*attrs*>\n</p>\n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*'))
|
2006-12-10 16:56:05 -05:00
|
|
|
assert_equal("<p escaped='quo\"te'>\n</p>\n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"'))
|
|
|
|
assert_equal("<p escaped=\"q'uo"te\">\n</p>\n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"'))
|
2006-11-07 20:54:26 -05:00
|
|
|
assert_equal("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n", render("!!! XML", :attr_wrapper => '"'))
|
2006-11-04 03:35:06 -05:00
|
|
|
end
|
|
|
|
|
2007-06-02 06:45:24 -04:00
|
|
|
def test_attrs_parsed_correctly
|
|
|
|
assert_equal("<p boom=>biddly='bar => baz'>\n</p>\n", render("%p{'boom=>biddly' => 'bar => baz'}"))
|
|
|
|
assert_equal("<p foo,bar='baz, qux'>\n</p>\n", render("%p{'foo,bar' => 'baz, qux'}"))
|
|
|
|
assert_equal("<p escaped='quo\nte'>\n</p>\n", render("%p{ :escaped => \"quo\\nte\"}"))
|
2007-06-02 18:39:03 -04:00
|
|
|
assert_equal("<p escaped='quo4te'>\n</p>\n", render("%p{ :escaped => \"quo\#{2 + 2}te\"}"))
|
2007-06-02 06:45:24 -04:00
|
|
|
end
|
2007-07-24 22:46:43 -04:00
|
|
|
|
|
|
|
def test_empty_attrs
|
|
|
|
assert_equal("<p attr=''>empty</p>\n", render("%p{ :attr => '' } empty"))
|
|
|
|
assert_equal("<p attr=''>empty</p>\n", render("%p{ :attr => x } empty", :locals => {:x => ''}))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_nil_attrs
|
|
|
|
assert_equal("<p>nil</p>\n", render("%p{ :attr => nil } nil"))
|
|
|
|
assert_equal("<p>nil</p>\n", render("%p{ :attr => x } nil", :locals => {:x => nil}))
|
|
|
|
end
|
2007-06-02 06:45:24 -04:00
|
|
|
|
2006-11-04 03:35:06 -05:00
|
|
|
def test_locals
|
|
|
|
assert_equal("<p>Paragraph!</p>\n", render("%p= text", :locals => { :text => "Paragraph!" }))
|
|
|
|
end
|
2007-05-10 04:12:20 -04:00
|
|
|
|
2007-11-24 03:35:10 -05:00
|
|
|
def test_deprecated_locals_option
|
|
|
|
Kernel.module_eval do
|
|
|
|
def warn_with_stub(msg); end
|
|
|
|
alias_method :warn_without_stub, :warn
|
|
|
|
alias_method :warn, :warn_with_stub
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal("<p>Paragraph!</p>\n", Haml::Engine.new("%p= text", :locals => { :text => "Paragraph!" }).render)
|
2007-09-19 02:11:47 -04:00
|
|
|
|
2007-11-24 03:35:10 -05:00
|
|
|
Kernel.module_eval { alias_method :warn, :warn_without_stub }
|
2007-09-19 02:11:47 -04:00
|
|
|
end
|
2007-05-10 04:12:20 -04:00
|
|
|
|
2007-08-26 13:12:22 -04:00
|
|
|
def test_dynamic_attrs_shouldnt_register_as_literal_values
|
2007-08-21 21:42:19 -04:00
|
|
|
assert_equal("<p a='b2c'>\n</p>\n", render('%p{:a => "b#{1 + 1}c"}'))
|
|
|
|
assert_equal("<p a='b2c'>\n</p>\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}"))
|
|
|
|
end
|
2007-01-20 20:24:16 -05:00
|
|
|
|
|
|
|
def test_rec_merge
|
2007-03-26 02:03:29 -04:00
|
|
|
hash1 = {1=>2, 3=>{5=>7, 8=>9}}
|
|
|
|
hash2 = {4=>5, 3=>{5=>2, 16=>12}}
|
|
|
|
hash3 = {1=>2, 4=>5, 3=>{5=>2, 8=>9, 16=>12}}
|
2007-01-20 20:24:16 -05:00
|
|
|
|
|
|
|
hash1.rec_merge!(hash2)
|
|
|
|
assert_equal(hash3, hash1)
|
|
|
|
end
|
2007-01-26 21:08:08 -05:00
|
|
|
|
2007-01-27 05:29:14 -05:00
|
|
|
def test_syntax_errors
|
|
|
|
errs = [ "!!!\n a", "a\n b", "a\n:foo\nb", "/ a\n b",
|
2007-06-22 15:20:48 -04:00
|
|
|
"% a", "%p a\n b", "a\n%p=\nb", "%p=\n a",
|
|
|
|
"a\n%p~\nb", "a\n~\nb", "a\n~\n b", "%p~\n b", "%p/\n a",
|
|
|
|
"%p\n \t%a b", "%a\n b\nc", "%a\n b\nc",
|
|
|
|
":notafilter\n This isn't\n a filter!",
|
2007-10-21 15:24:34 -04:00
|
|
|
".{} a", "\#{} a", ".= 'foo'", "%a/ b", "%p..class", "%p..#." ]
|
2007-01-27 05:29:14 -05:00
|
|
|
errs.each do |err|
|
|
|
|
begin
|
|
|
|
render(err)
|
|
|
|
rescue Exception => e
|
2007-11-23 03:24:11 -05:00
|
|
|
assert(e.is_a?(Haml::Error), "#{err.dump} doesn't produce Haml::SyntaxError")
|
2007-01-27 05:29:14 -05:00
|
|
|
else
|
2007-11-23 03:24:11 -05:00
|
|
|
assert(false, "#{err.dump} doesn't produce an exception")
|
2007-01-27 05:29:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-11-23 03:24:11 -05:00
|
|
|
def test_syntax_error
|
2007-11-24 03:35:10 -05:00
|
|
|
render("a\nb\n!!!\n c\nd")
|
|
|
|
rescue Haml::SyntaxError => e
|
|
|
|
assert_equal(e.message, "Illegal Nesting: Nesting within a header command is illegal.")
|
2007-11-25 22:26:16 -05:00
|
|
|
assert_equal("(haml):3", e.backtrace[0])
|
2007-11-24 03:35:10 -05:00
|
|
|
rescue Exception => e
|
|
|
|
assert(false, '"a\nb\n!!!\n c\nd" doesn\'t produce a Haml::SyntaxError')
|
|
|
|
else
|
|
|
|
assert(false, '"a\nb\n!!!\n c\nd" doesn\'t produce an exception')
|
|
|
|
end
|
|
|
|
|
2007-11-25 22:26:16 -05:00
|
|
|
def test_exception
|
|
|
|
render("%p\n hi\n %a= undefined\n= 12")
|
2007-11-24 03:35:10 -05:00
|
|
|
rescue Exception => e
|
2007-11-25 22:26:16 -05:00
|
|
|
assert_match("(haml):3", e.backtrace[0])
|
2007-11-24 03:35:10 -05:00
|
|
|
else
|
|
|
|
# Test failed... should have raised an exception
|
|
|
|
assert(false)
|
2007-11-23 03:24:11 -05:00
|
|
|
end
|
|
|
|
|
2007-01-27 05:29:14 -05:00
|
|
|
def test_compile_error
|
2007-11-25 22:26:16 -05:00
|
|
|
render("a\nb\n- fee)\nc")
|
2007-11-24 03:35:10 -05:00
|
|
|
rescue Exception => e
|
2007-11-25 22:26:16 -05:00
|
|
|
assert_match(/^compile error\n\(haml\):3: syntax error/i, e.message)
|
2007-11-24 03:35:10 -05:00
|
|
|
else
|
|
|
|
assert(false,
|
2007-11-25 22:26:16 -05:00
|
|
|
'"a\nb\n- fee)\nc" doesn\'t produce an exception!')
|
2007-01-27 05:29:14 -05:00
|
|
|
end
|
2007-01-31 01:38:23 -05:00
|
|
|
|
2007-11-25 20:36:57 -05:00
|
|
|
def test_unbalanced_brackets
|
|
|
|
render('== #{1 + 5} foo #{6 + 7 bar #{8 + 9}')
|
|
|
|
rescue Haml::SyntaxError => e
|
|
|
|
assert_equal("Unbalanced brackets.", e.message)
|
|
|
|
end
|
|
|
|
|
2007-01-31 01:38:23 -05:00
|
|
|
def test_no_bluecloth
|
|
|
|
Kernel.module_eval do
|
2007-08-11 17:04:51 -04:00
|
|
|
def gem_original_require_with_bluecloth(file)
|
2007-01-31 01:38:23 -05:00
|
|
|
raise LoadError if file == 'bluecloth'
|
2007-08-11 17:04:51 -04:00
|
|
|
gem_original_require_without_bluecloth(file)
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
2007-08-11 17:04:51 -04:00
|
|
|
alias_method :gem_original_require_without_bluecloth, :gem_original_require
|
|
|
|
alias_method :gem_original_require, :gem_original_require_with_bluecloth
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
|
|
|
|
2007-08-11 17:04:51 -04:00
|
|
|
begin
|
|
|
|
assert_equal("<h1>Foo</h1>\t<p>- a\n- b</p>\n",
|
|
|
|
Haml::Engine.new(":markdown\n Foo\n ===\n - a\n - b").to_html)
|
|
|
|
rescue Haml::HamlError => e
|
|
|
|
if e.message == "Can't run Markdown filter; required 'bluecloth' or 'redcloth', but none were found"
|
|
|
|
puts "\nCouldn't require 'bluecloth' or 'redcloth'; skipping a test."
|
|
|
|
else
|
|
|
|
raise e
|
|
|
|
end
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Kernel.module_eval do
|
2007-08-11 17:04:51 -04:00
|
|
|
alias_method :gem_original_require, :gem_original_require_without_bluecloth
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_no_redcloth
|
|
|
|
Kernel.module_eval do
|
2007-08-11 17:04:51 -04:00
|
|
|
def gem_original_require_with_redcloth(file)
|
2007-01-31 01:38:23 -05:00
|
|
|
raise LoadError if file == 'redcloth'
|
2007-08-11 17:04:51 -04:00
|
|
|
gem_original_require_without_redcloth(file)
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
2007-08-11 17:04:51 -04:00
|
|
|
alias_method :gem_original_require_without_redcloth, :gem_original_require
|
|
|
|
alias_method :gem_original_require, :gem_original_require_with_redcloth
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
Haml::Engine.new(":redcloth\n _foo_").to_html
|
|
|
|
rescue Haml::HamlError
|
|
|
|
else
|
|
|
|
assert(false, "No exception raised!")
|
|
|
|
end
|
|
|
|
|
|
|
|
Kernel.module_eval do
|
2007-08-11 17:04:51 -04:00
|
|
|
alias_method :gem_original_require, :gem_original_require_without_redcloth
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
2007-08-11 17:04:51 -04:00
|
|
|
end
|
2007-01-31 01:38:23 -05:00
|
|
|
|
2007-08-11 17:04:51 -04:00
|
|
|
def test_no_redcloth_or_bluecloth
|
|
|
|
Kernel.module_eval do
|
|
|
|
def gem_original_require_with_redcloth_and_bluecloth(file)
|
|
|
|
raise LoadError if file == 'redcloth' || file == 'bluecloth'
|
|
|
|
gem_original_require_without_redcloth_and_bluecloth(file)
|
|
|
|
end
|
|
|
|
alias_method :gem_original_require_without_redcloth_and_bluecloth, :gem_original_require
|
|
|
|
alias_method :gem_original_require, :gem_original_require_with_redcloth_and_bluecloth
|
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
Haml::Engine.new(":markdown\n _foo_").to_html
|
|
|
|
rescue Haml::HamlError
|
|
|
|
else
|
|
|
|
assert(false, "No exception raised!")
|
|
|
|
end
|
|
|
|
|
|
|
|
Kernel.module_eval do
|
|
|
|
alias_method :gem_original_require, :gem_original_require_without_redcloth_and_bluecloth
|
|
|
|
end
|
2007-01-31 01:38:23 -05:00
|
|
|
end
|
2007-04-15 21:38:25 -04:00
|
|
|
|
|
|
|
def test_local_assigns_dont_modify_class
|
|
|
|
assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'}))
|
|
|
|
assert_equal(nil, defined?(foo))
|
|
|
|
end
|
2007-04-17 02:49:07 -04:00
|
|
|
|
|
|
|
def test_object_ref_with_nil_id
|
|
|
|
user = Struct.new('User', :id).new
|
|
|
|
assert_equal("<p class='struct_user' id='struct_user_new'>New User</p>\n",
|
|
|
|
render("%p[user] New User", :locals => {:user => user}))
|
|
|
|
end
|
2007-11-23 02:02:07 -05:00
|
|
|
|
|
|
|
def test_render_should_accept_a_binding_as_scope
|
|
|
|
string = "This is a string!"
|
|
|
|
string.instance_variable_set("@var", "Instance variable")
|
2007-11-23 02:42:59 -05:00
|
|
|
b = string.instance_eval do
|
|
|
|
var = "Local variable"
|
|
|
|
binding
|
|
|
|
end
|
2007-11-23 02:02:07 -05:00
|
|
|
|
2007-11-23 02:42:59 -05:00
|
|
|
assert_equal("<p>THIS IS A STRING!</p>\n<p>Instance variable</p>\n<p>Local variable</p>\n",
|
|
|
|
render("%p= upcase\n%p= @var\n%p= var", :scope => b))
|
2007-11-23 02:02:07 -05:00
|
|
|
end
|
2007-11-23 07:14:02 -05:00
|
|
|
|
|
|
|
def test_yield_should_work_with_binding
|
|
|
|
assert_equal("12\nFOO\n", render("= yield\n= upcase", :scope => "foo".instance_eval{binding}) { 12 })
|
|
|
|
end
|
2007-11-23 21:32:18 -05:00
|
|
|
|
|
|
|
def test_yield_should_work_with_def_method
|
|
|
|
s = "foo"
|
|
|
|
Haml::Engine.new("= yield\n= upcase").def_method(s, :render)
|
|
|
|
assert_equal("12\nFOO\n", s.render { 12 })
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_def_method_with_module
|
|
|
|
Haml::Engine.new("= yield\n= upcase").def_method(String, :render_haml)
|
|
|
|
assert_equal("12\nFOO\n", "foo".render_haml { 12 })
|
|
|
|
end
|
2007-11-24 03:35:10 -05:00
|
|
|
|
|
|
|
def test_def_method_locals
|
|
|
|
obj = Object.new
|
|
|
|
Haml::Engine.new("%p= foo\n.bar{:baz => baz}= boom").def_method(obj, :render, :foo, :baz, :boom)
|
|
|
|
assert_equal("<p>1</p>\n<div baz='2' class='bar'>3</div>\n", obj.render(:foo => 1, :baz => 2, :boom => 3))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_render_proc_locals
|
|
|
|
proc = Haml::Engine.new("%p= foo\n.bar{:baz => baz}= boom").render_proc(Object.new, :foo, :baz, :boom)
|
|
|
|
assert_equal("<p>1</p>\n<div baz='2' class='bar'>3</div>\n", proc[:foo => 1, :baz => 2, :boom => 3])
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_render_proc_with_binding
|
|
|
|
assert_equal("FOO\n", Haml::Engine.new("= upcase").render_proc("foo".instance_eval{binding}).call)
|
|
|
|
end
|
2006-06-30 11:14:44 -04:00
|
|
|
end
|