diff --git a/src/YAML.jl b/src/YAML.jl index ddb1791..1a1eb05 100644 --- a/src/YAML.jl +++ b/src/YAML.jl @@ -83,8 +83,7 @@ iterate(it::YAMLDocIterator) = next(it, start(it)) iterate(it::YAMLDocIterator, s) = done(it, s) ? nothing : next(it, s) Base.IteratorSize(::Type{YAMLDocIterator}) = Base.SizeUnknown() -Base.IteratorEltype(::Type{YAMLDocIterator}) = Base.HasEltype() -Base.eltype(it::YAMLDocIterator) = Dict{Any, Any} +Base.IteratorEltype(::Type{YAMLDocIterator}) = Base.EltypeUnknown() load_all(input::IO, args...; kwargs...) = YAMLDocIterator(input, args...; kwargs...) diff --git a/test/runtests.jl b/test/runtests.jl index 5957fb2..2100fbd 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -279,6 +279,8 @@ test: 2 \ufeff--- test: 3 +\ufeff--- +42 """ @testset "multi_doc_bom" begin @@ -289,6 +291,8 @@ test: 3 @test equivalent(val, Dict("test" => 2)) (val, state) = iterate(iterable, state) @test equivalent(val, Dict("test" => 3)) + (val, state) = iterate(iterable, state) + @test equivalent(val, 42) @test iterate(iterable, state) === nothing end @@ -304,6 +308,8 @@ end @test equivalent(val, Dict("test" => 2)) (val, state) = iterate(iterable, state) @test equivalent(val, Dict("test" => 3)) + (val, state) = iterate(iterable, state) + @test equivalent(val, 42) @test iterate(iterable, state) === nothing end @@ -314,9 +320,8 @@ end end iterable = YAML.load_all_file(fname) @test Base.IteratorSize(YAML.YAMLDocIterator) == Base.SizeUnknown() - @test Base.IteratorEltype(YAML.YAMLDocIterator) == Base.HasEltype() - @test eltype(iterable) == Dict{Any, Any} - @test length(collect(iterable)) == 3 + @test Base.IteratorEltype(YAML.YAMLDocIterator) == Base.EltypeUnknown() + @test length(collect(iterable)) == 4 end # test that an OrderedDict is written in the correct order