Skip to content

Commit

Permalink
Limit test_throws to julia versions using cat definition in Compat
Browse files Browse the repository at this point in the history
On 0.7, calls to Compat.cat without dims would not error due to support for the
deprecated syntax. On 1.0, calls without  dims would error with a different type
of exception. I changed the exception type to be consistent across versions, and
only checked for the exception of versions using Compat's definition of cat.
  • Loading branch information
galenlynch committed Aug 12, 2018
1 parent 0316bd5 commit be76c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,7 @@ if VERSION < v"0.7.0-DEV.4738"
Base.squeeze(A; dims=error("squeeze: keyword argument dims not assigned")) = squeeze(A, dims)
end
if VERSION < v"0.7.0-DEV.5165" # julia#27163
cat(X...; dims = error("cat: keyword argument dims not assigned")) = Base.cat(dims, X...)
cat(X...; dims = throw(UndefKeywordError("cat: keyword argument dims not assigned"))) = Base.cat(dims, X...)
end

if !isdefined(Base, :selectdim) # 0.7.0-DEV.3976
Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,9 @@ end
# 0.7.0-DEV.5165
@test Compat.cat([1, 2], [3, 4, 5], dims = 1) == [1, 2, 3, 4, 5]
@test Compat.cat([1, 2], [3, 4], dims = 2) == [1 3; 2 4]
@test_throws ErrorException Compat.cat([1, 2], [3, 4])
if VERSION < v"0.7.0-DEV.5165"
@test_throws UndefKeywordError Compat.cat([1, 2], [3, 4])
end

# 0.7.0-DEV.3976
let A = rand(5,5)
Expand Down

0 comments on commit be76c2c

Please sign in to comment.