Sha256: 26bf3d6d185bb4e397b4cc8264057a7b5a146fb1dc698444b42ce589d1f5774e
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'test_helper' class TempleLineCounterTest < Haml::TestCase TESTED_TEMPLES = [ [:multi, [:code, "foo"], [:static, "bar"], [:dynamic, "baz"], ], [:multi, [:code, "foo\nbar\nbaz"], [:static, "foo\nbar\nbaz"], [:dynamic, "foo\nbar\nbaz"], ], [:case, ["'a\nb', false", [:static, "hello\n"]], [:else, [:code, "raise 'error\n'"]], ], [:escape, true, [:dynamic, "foo\nbar"]], [:escape, :once, [:dynamic, "foo\nbar"]], [:escape, false, [:dynamic, "foo\nbar"]], [:escape, true, [:static, "foo\nbar"]], [:escape, :once, [:static, "foo\nbar"]], [:escape, false, [:dynamic, "foo\nbar"]], ] def test_count_lines TESTED_TEMPLES.each do |temple| code = Haml::TempleEngine.chain.inject(temple) do |exp, (symbol, filter)| case symbol when :Parser, :Compiler exp else filter.call(Haml::TempleEngine).call(exp) end end assert_equal code.count("\n"), Haml::TempleLineCounter.count_lines(temple) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
haml-5.0.1 | test/temple_line_counter_test.rb |
haml-5.0.0 | test/temple_line_counter_test.rb |
haml-5.0.0.beta.2 | test/temple_line_counter_test.rb |