Skip to content

Commit

Permalink
Test that similar throws a MethodError for unsupported dims types
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Aug 18, 2016
1 parent ac0367b commit c338485
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/offsetarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,20 @@ for s = -5:5
end

end # let

# Check that similar throws a MethodError rather than a
# StackOverflowError if no appropriate method has been defined
# (#18107)
module SimilarUR
using Base.Test
immutable MyURange <: AbstractUnitRange{Int}
start::Int
stop::Int
end
ur = MyURange(1,3)
a = Array{Int}(2)
@test_throws MethodError similar(a, ur)
@test_throws MethodError similar(a, Float64, ur)
@test_throws MethodError similar(a, Float64, (ur,))
@test_throws MethodError similar(a, (2.0,3.0))
end

0 comments on commit c338485

Please sign in to comment.