Skip to content

Commit

Permalink
Merge pull request #61 from AsafManela/master
Browse files Browse the repository at this point in the history
permit deleteat! to take any idx, not just Integer
  • Loading branch information
quinnj authored May 17, 2019
2 parents caf4ed4 + 787d6fe commit 41d5288
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/WeakRefStrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ function Base.push!(arr::StringVector, val::Missing)
push!(arr.lengths, 0)
end

function Base.deleteat!(arr::StringVector, idx::Integer)
function Base.deleteat!(arr::StringVector, idx)
deleteat!(arr.lengths, idx)
deleteat!(arr.offsets, idx)
arr
Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,16 @@ end
sv = StringVector{EscapedString{UInt8('"')}}(["Text\"\"inner quote\"\"Parse", "JuliaDB"])
@test sv[1] == "Text\"inner quote\"Parse"
end

@testset "deleteat!" begin
sv1 = StringVector{WeakRefString{UInt8}}(["foo", "bar"])
@test deleteat!(copy(sv1), 1) == ["bar"]
@test deleteat!(copy(sv1), [1,2]) == []
@test deleteat!(copy(sv1), 1:2) == []

sv2 = StringVector{String}(["baz", "qux"])
@test deleteat!(copy(sv2), 1) == ["qux"]
@test deleteat!(copy(sv2), [1,2]) == []
@test deleteat!(copy(sv2), 1:2) == []
end
end

0 comments on commit 41d5288

Please sign in to comment.