Skip to content

Commit 75f5f2d

Browse files
committed
Add tests
1 parent b9f3e37 commit 75f5f2d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/_functions.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ end
148148

149149
@test axiskeys(filter(isodd, V2),1) isa Vector{Int}
150150
@test dimnames(filter(isodd, V2)) == (:v,)
151-
151+
152152
V4 = wrapdims(rand(1:99, 10), collect(2:11))
153153
V4c = copy(V4)
154154
@test filter!(isodd, V4c) === V4c == filter(isodd, V4)
@@ -288,6 +288,17 @@ end
288288
@test ka == KeyedArray([4, 5, 6.0], a=1:3)
289289
end
290290

291+
@testset "empty!" begin
292+
kv = wrapdims([1, 2, 3, 4, 5, 6.0], a=[:a, :b, :c, :d, :e, :f])
293+
@test kv == empty!(kv)
294+
@test isempty(kv)
295+
296+
# make sure array is not in an invalid state if the emtpy for indices fails
297+
ka = wrapdims([4, 5, 6.0], a=1:3)
298+
@test_throws MethodError empty!(ka)
299+
@test ka == KeyedArray([4, 5, 6.0], a=1:3)
300+
end
301+
291302
@testset "equality" begin
292303

293304
data = parent(parent(M))

0 commit comments

Comments
 (0)