more tests and fixes
This commit is contained in:
parent
457f4104d4
commit
e6c0702811
|
@ -2,7 +2,7 @@ module BibTeX
|
||||||
export Bibliography, Citation
|
export Bibliography, Citation
|
||||||
|
|
||||||
include("parser.jl")
|
include("parser.jl")
|
||||||
include("bibitem.jl")
|
include("citation.jl")
|
||||||
include("bib.jl")
|
include("bibliography.jl")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ function Citation!(data::Dict{String,String})
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.similar(b::Citation{S}) where {S} = Citation{S}(Dict{String,String}())
|
Base.similar(b::Citation{S}) where {S} = Citation{S}(Dict{String,String}())
|
||||||
Base.rehash!(b::Citation, n=length(b.data)) = begin rehash!(b.data, n); b; end
|
Base.rehash!(b::Citation, n=length(b.data)) = begin Base.rehash!(b.data, n); b; end
|
||||||
Base.sizehint!(b::Citation, n) = begin sizehint!(b.data, n); b; end
|
Base.sizehint!(b::Citation, n) = begin sizehint!(b.data, n); b; end
|
||||||
Base.empty!(b::Citation) = begin empty!(b.data); b; end
|
Base.empty!(b::Citation) = begin empty!(b.data); b; end
|
||||||
Base.copy(b::Citation{S}) where {S} = Citation{S}(copy(b.data))
|
Base.copy(b::Citation{S}) where {S} = Citation{S}(copy(b.data))
|
|
@ -31,12 +31,19 @@ end
|
||||||
|
|
||||||
Base.rehash!(b)
|
Base.rehash!(b)
|
||||||
b2 = copy(b)
|
b2 = copy(b)
|
||||||
|
@test length(b2) == length(b)
|
||||||
@test isempty(sizehint!(empty!(b2),10))
|
@test isempty(sizehint!(empty!(b2),10))
|
||||||
@test isempty(similar(b))
|
@test isempty(similar(b))
|
||||||
b2["x"] = Citation{:foo}()
|
b2["x"] = Citation{:foo}()
|
||||||
b2["x"]["bar"] = "blah"
|
b2["x"]["bar"] = "blah"
|
||||||
@test length(b2) == length(b2["x"]) == 1
|
@test length(b2) == length(b2["x"]) == 1
|
||||||
@test b2["x"]["bar"] == "blah"
|
@test b2["x"]["bar"] == "blah"
|
||||||
|
@test get(b2["x"], "foo", nothing) === nothing
|
||||||
@test collect(b2)[1][2] == b2["x"]
|
@test collect(b2)[1][2] == b2["x"]
|
||||||
@test collect(b2["x"])[1] == ("bar"=>"blah")
|
@test collect(b2["x"])[1] == ("bar"=>"blah")
|
||||||
|
Base.rehash!(b2["x"])
|
||||||
|
x2 = copy(b2["x"])::Citation{:foo}
|
||||||
|
@test length(x2) == 1
|
||||||
|
@test isempty(similar(x2))
|
||||||
|
@test isempty(sizehint!(empty!(x2),10))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue