add tests

This commit is contained in:
mmacia committed 2026-08-11 22:39:48 +00:00
1 parent 03e0f7c9d4
commit 37ef12206b
2 files changed
+6 -2

No files matched your search

+4
View File
@@ -56,6 +56,10 @@ defmodule FeedReader.CollectorTest do
FeedReader.parse_binary(@xml <> "<broken", max_items: 2)
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
assert {:error, :invalid_chunk} =
FeedReader.parse_stream([@xml, 123], max_items: 2)
+2 -2
View File
@@ -24,8 +24,8 @@ defmodule FeedReader.StreamingTest do
assert File.read!(path) == @xml
end
test "ignores a UTF-8 BOM split across input chunks" do
xml = <<0xEF, 0xBB, 0xBF>> <> @xml
test "ignores a BOM and XML whitespace split across input chunks" do
xml = <<0xEF, 0xBB, 0xBF, 32, 9, 13, 10>> <> ~s(<?xml version="1.0"?>) <> @xml
path = write_temp(xml)
on_exit(fn -> File.rm(path) end)