Skip to content

Commit

Permalink
add failing test for non-utf8 encoding (#6339)
Browse files Browse the repository at this point in the history
Merge pull request 6339
  • Loading branch information
Crunch09 authored and jekyllbot committed Oct 17, 2017
1 parent f89a3b2 commit c5c4201
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions test/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ def assert_equal_value(key, one, other)
assert_equal(one[key], other[key])
end

def setup_encoded_document(filename)
site = fixture_site("collections" => ["encodings"])
site.process
Document.new(site.in_source_dir(File.join("_encodings", filename)), {
:site => site,
:collection => site.collections["encodings"],
}).tap(&:read)
end

context "a document in a collection" do
setup do
@site = fixture_site({
Expand Down Expand Up @@ -529,4 +538,24 @@ def assert_equal_value(key, one, other)
assert_equal true, File.file?(@dest_file)
end
end

context "a document with UTF-8 CLRF" do
setup do
@document = setup_encoded_document "UTF8CRLFandBOM.md"
end

should "not throw an error" do
Jekyll::Renderer.new(@document.site, @document).render_document
end
end

context "a document with UTF-16LE CLRF" do
setup do
@document = setup_encoded_document "Unicode16LECRLFandBOM.md"
end

should "not throw an error" do
Jekyll::Renderer.new(@document.site, @document).render_document
end
end
end

0 comments on commit c5c4201

Please sign in to comment.