test/data_sources/test_filesystem.rb in nanoc3-3.2.3 vs test/data_sources/test_filesystem.rb in nanoc3-3.2.4
- old
+ new
@@ -363,9 +363,25 @@
result = data_source.instance_eval { parse('test.html', nil, 'foobar') }
assert_equal({}, result[0])
assert_equal('blah blah', result[1])
end
+ def test_parse_utf8_bom
+ File.open('test.html', 'w') do |io|
+ io.write [ 0xEF, 0xBB, 0xBF ].map { |i| i.chr }.join
+ io.write "-----\n"
+ io.write "utf8bomawareness: high\n"
+ io.write "-----\n"
+ io.write "content goes here\n"
+ end
+
+ data_source = Nanoc3::DataSources::FilesystemCombined.new(nil, nil, nil, nil)
+
+ result = data_source.instance_eval { parse('test.html', nil, 'foobar') }
+ assert_equal({ 'utf8bomawareness' => 'high' }, result[0])
+ assert_equal('content goes here', result[1])
+ end
+
def test_parse_embedded_no_meta
content = "blah\n" \
"blah blah blah\n" \
"blah blah\n"