add tests
This commit is contained in:
1 parent
03e0f7c9d4
commit
37ef12206b
2 files changed
+6
-2
No files matched your search
@@ -56,6 +56,10 @@ defmodule FeedReader.CollectorTest do
|
|||||||
FeedReader.parse_binary(@xml <> "<broken", max_items: 2)
|
FeedReader.parse_binary(@xml <> "<broken", max_items: 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "rejects non-whitespace content before the XML document" do
|
||||||
|
assert {:error, _reason} = FeedReader.parse_binary("junk" <> @xml, max_items: 2)
|
||||||
|
end
|
||||||
|
|
||||||
test "rejects invalid chunks and binary arguments" do
|
test "rejects invalid chunks and binary arguments" do
|
||||||
assert {:error, :invalid_chunk} =
|
assert {:error, :invalid_chunk} =
|
||||||
FeedReader.parse_stream([@xml, 123], max_items: 2)
|
FeedReader.parse_stream([@xml, 123], max_items: 2)
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ defmodule FeedReader.StreamingTest do
|
|||||||
assert File.read!(path) == @xml
|
assert File.read!(path) == @xml
|
||||||
end
|
end
|
||||||
|
|
||||||
test "ignores a UTF-8 BOM split across input chunks" do
|
test "ignores a BOM and XML whitespace split across input chunks" do
|
||||||
xml = <<0xEF, 0xBB, 0xBF>> <> @xml
|
xml = <<0xEF, 0xBB, 0xBF, 32, 9, 13, 10>> <> ~s(<?xml version="1.0"?>) <> @xml
|
||||||
path = write_temp(xml)
|
path = write_temp(xml)
|
||||||
|
|
||||||
on_exit(fn -> File.rm(path) end)
|
on_exit(fn -> File.rm(path) end)
|
||||||
|
|||||||
Reference in new issue
Block a user