Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bf422dc3b6
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (18 sloc) 0.691 kb
require "test/unit"
require "json"
require "haml"
class HamlTest < Test::Unit::TestCase
contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
contexts.each do |context|
context[1].each do |name, test|
class_eval(<<-EOTEST)
def test_#{name.gsub(/\s+|[^a-zA-Z0-9_]/, "_")}
locals = Hash[*(#{test}["locals"] || {}).collect {|k, v| [k.to_sym, v] }.flatten]
options = Hash[*(#{test}["config"] || {}).collect {|k, v| [k.to_sym, v.to_sym] }.flatten]
engine = Haml::Engine.new(#{test}["haml"], options)
assert_equal(engine.render(Object.new, locals).chomp, #{test}["html"])
end
EOTEST
end
end
end
Jump to Line
Something went wrong with that request. Please try again.