haml 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TempleLineCounterTest < Haml::TestCase
4
- TESTED_TEMPLES = [
5
- [:multi,
6
- [:code, "foo"],
7
- [:static, "bar"],
8
- [:dynamic, "baz"],
9
- ],
10
- [:multi,
11
- [:code, "foo\nbar\nbaz"],
12
- [:static, "foo\nbar\nbaz"],
13
- [:dynamic, "foo\nbar\nbaz"],
14
- ],
15
- [:case,
16
- ["'a\nb', false", [:static, "hello\n"]],
17
- [:else, [:code, "raise 'error\n'"]],
18
- ],
19
- [:escape, true, [:dynamic, "foo\nbar"]],
20
- [:escape, :once, [:dynamic, "foo\nbar"]],
21
- [:escape, false, [:dynamic, "foo\nbar"]],
22
- [:escape, true, [:static, "foo\nbar"]],
23
- [:escape, :once, [:static, "foo\nbar"]],
24
- [:escape, false, [:dynamic, "foo\nbar"]],
25
- ]
26
-
27
- def test_count_lines
28
- TESTED_TEMPLES.each do |temple|
29
- code = Haml::TempleEngine.chain.inject(temple) do |exp, (symbol, filter)|
30
- case symbol
31
- when :Parser, :Compiler
32
- exp
33
- else
34
- filter.call(Haml::TempleEngine).call(exp)
35
- end
36
- end
37
- assert_equal code.count("\n"), Haml::TempleLineCounter.count_lines(temple)
38
- end
39
- end
40
- end
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UtilTest < Haml::TestCase
4
- include Haml::Util
5
-
6
- def test_silence_warnings
7
- old_stderr, $stderr = $stderr, StringIO.new
8
- warn "Out"
9
- assert_equal("Out\n", $stderr.string)
10
- silence_warnings {warn "In"}
11
- assert_equal("Out\n", $stderr.string)
12
- ensure
13
- $stderr = old_stderr
14
- end
15
-
16
- def test_check_encoding_does_not_destoy_the_given_string
17
- string_with_bom = File.read(File.dirname(__FILE__) + '/templates/with_bom.haml', :encoding => Encoding::UTF_8)
18
- original = string_with_bom.dup
19
- check_encoding(string_with_bom)
20
- assert_equal(original, string_with_bom)
21
- end
22
- end