Skip to content
Newer
Older
100644 24 lines (21 sloc) 831 Bytes
e0c6969 @norman Unify test implementation with Haml's.
norman authored
1 require "rubygems"
ed0ea41 @mattwildig Use minitest rather than test/unit
mattwildig authored
2 require "minitest/autorun"
8716e3c @norman Made Ruby runner use test/unit for simplicity. Fixed typos in test na…
norman authored
3 require "json"
4 require "haml"
5
ed0ea41 @mattwildig Use minitest rather than test/unit
mattwildig authored
6 class HamlTest < MiniTest::Unit::TestCase
8716e3c @norman Made Ruby runner use test/unit for simplicity. Fixed typos in test na…
norman authored
7 contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
8 contexts.each do |context|
9 context[1].each do |name, test|
e0c6969 @norman Unify test implementation with Haml's.
norman authored
10 define_method("test_spec: #{name} (#{context[0]})") do
11 html = test["html"]
12 haml = test["haml"]
13 locals = Hash[(test["locals"] || {}).map {|x, y| [x.to_sym, y]}]
14 options = Hash[(test["config"] || {}).map {|x, y| [x.to_sym, y]}]
15 options[:format] = options[:format].to_sym if options.key?(:format)
73b0d27 @mattwildig Silence unused variable warning.
mattwildig authored
16 engine = Haml::Engine.new(haml, options)
e0c6969 @norman Unify test implementation with Haml's.
norman authored
17 result = engine.render(Object.new, locals)
18
19 assert_equal html, result.strip
20 end
8716e3c @norman Made Ruby runner use test/unit for simplicity. Fixed typos in test na…
norman authored
21 end
22 end
23 end
Something went wrong with that request. Please try again.