Skip to content

Commit

Permalink
Fix and test ArgumentError for nonexistant dir
Browse files Browse the repository at this point in the history
  • Loading branch information
bencottier committed Oct 13, 2021
1 parent 9e0b661 commit c40db33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ You can also work with it directly, say you wanted to get all checkpoints files
2: https://github.com/JuliaData/DataFrames.jl
"""
function index_checkpoint_files(dir::AbstractPath)
isdir(dir) || throw(ArgumentError(dir, "Need an existing directory."))
isdir(dir) || throw(ArgumentError("Need an existing directory."))
map(Iterators.filter(==("jlso") extension, walkpath(dir))) do checkpoint_path
return IndexEntry(checkpoint_path)
end
Expand Down
4 changes: 4 additions & 0 deletions test/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@
@test_throws ErrorException entry.tags
end
end

@testset "nonexistent dir" begin
@test_throws ArgumentError index_checkpoint_files("nonexistent_dir")
end
end

0 comments on commit c40db33

Please sign in to comment.