Skip to content

Commit

Permalink
Tests for unicode chars
Browse files Browse the repository at this point in the history
  • Loading branch information
silasb committed Apr 25, 2019
1 parent 3eb0ef0 commit 43c1d0b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/csv-to-json_spec.cr
Expand Up @@ -82,5 +82,27 @@ describe Csv::To::Json do
end
end
end

context "unicode data issues" do
it "will parse あ char" do
in_io = IO::Memory.new("field 1\n")
out_io = IO::Memory.new()

Csv::To::Json.run(in_io, out_io)

out_io.seek(0)
out_io.to_s.should contain(%([\n{"field 1":"あ"}\n]\n))
end

it "will parse \u0041 char" do
in_io = IO::Memory.new("field 1\n\u0041")
out_io = IO::Memory.new()

Csv::To::Json.run(in_io, out_io)

out_io.seek(0)
out_io.to_s.should contain(%([\n{"field 1":"A"}\n]\n))
end
end
end
end

0 comments on commit 43c1d0b

Please sign in to comment.