Skip to content

Commit 5af0c1f

Browse files
committed
Add tests for uncovered lines in coverage
1 parent fdf804e commit 5af0c1f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/ordered_robin_dict.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ end
123123

124124
function setindex!(h::OrderedRobinDict{K, V}, v0, key0) where {K,V}
125125
key = convert(K,key0)
126-
if !isequal(key,key0)
127-
throw(ArgumentError("$key0 is not a valid key for type $K"))
128-
end
126+
129127
v = convert(V, v0)
130128

131129
index = get(h.dict, key, -2)
@@ -217,9 +215,6 @@ get!(collection, key, default)
217215

218216
function get!(h::OrderedRobinDict{K,V}, key0, default) where {K,V}
219217
key = convert(K,key0)
220-
if !isequal(key,key0)
221-
throw(ArgumentError("$key0 is not a valid key for type $K"))
222-
end
223218

224219
index = get(h.dict, key, -2)
225220

test/test_ordered_robin_dict.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@
172172
@test isa(d2, OrderedRobinDict{Int,Int})
173173
@test isa(d3, OrderedRobinDict{Int,Int})
174174
@test isa(d4, OrderedRobinDict{Int,Int})
175+
176+
h = OrderedRobinDict{Int, Char}(1=>'a')
177+
@test h[1] == 'a'
175178
end
176179

177180
@testset "from tuple/vector/pairs/tuple of pair 2" begin
@@ -334,6 +337,7 @@
334337

335338
@testset "Issue #216" begin
336339
@test !isordered(Dict{Int, String})
340+
@test isordered(OrderedRobinDict{Int, String})
337341
end
338342

339343
@testset "Test merging" begin
@@ -404,6 +408,9 @@
404408
for i in 10:-1:1
405409
@test pop!(h) == (i => i+1)
406410
end
411+
412+
d = OrderedRobinDict(1=>'a', 2=>'b', 3=>'c')
413+
@test pop!(d, 4, 'e') == 'e'
407414
end
408415

409416
@testset "filter!" begin

0 commit comments

Comments
 (0)