1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/test/util_test.rb
Dillon Welch 1d446b3320 Frozen string literal changes (#967)
* Frozen string

* Revert changes that are slower

* Add object to map conversion for temple engine

* Revert more frozen strings

* Get rid of unnecessary extra array

* Revert this change because it's slower in benchmarks

* parser

* true for filters

* compiler

* temple

* finalize
2017-10-29 16:50:24 +09:00

23 lines
655 B
Ruby

# frozen_string_literal: true
require 'test_helper'
class UtilTest < Haml::TestCase
include Haml::Util
def test_silence_warnings
old_stderr, $stderr = $stderr, StringIO.new
warn "Out"
assert_equal("Out\n", $stderr.string)
silence_warnings {warn "In"}
assert_equal("Out\n", $stderr.string)
ensure
$stderr = old_stderr
end
def test_check_encoding_does_not_destoy_the_given_string
string_with_bom = File.read(File.dirname(__FILE__) + '/templates/with_bom.haml', :encoding => Encoding::UTF_8)
original = string_with_bom.dup
check_encoding(string_with_bom)
assert_equal(original, string_with_bom)
end
end