Skip to content

Commit

Permalink
De-activate tests dependent on Base.Test.with_handler on 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasaschan committed Sep 28, 2015
1 parent 7646fe9 commit 9a0c98a
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions test/scaling/nointerp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,31 @@ end

@test length(gradient(sitp, pi/3, 2)) == 1

# Test error messages for incorrect initialization
function message_is(message)
r -> r.err.msg == message || error("Incorrect error message: expected '$message' but was '$(r.err.msg)'")
end
Test.with_handler(message_is("Must scale 2-dimensional interpolation object with exactly 2 ranges (you used 1)")) do
@test scale(itp, xs)
end
Test.with_handler(message_is("NoInterp dimension 2 must be scaled with unit range 1:3")) do
@test scale(itp, xs, -1:1)
end
Test.with_handler(message_is("The length of the range in dimension 1 (8) did not equal the size of the interpolation object in that direction (11)")) do
@test scale(itp, -pi:2pi/7:pi, 1:3)
end
Test.with_handler(message_is("Must index into 2-dimensional scaled interpolation object with exactly 2 indices (you used 1)")) do
@test sitp[2.3]
end
Test.with_handler(message_is("Must index into 2-dimensional scaled interpolation object with exactly 2 indices (you used 1)")) do
@test gradient(sitp, 2.3)
end
Test.with_handler(message_is("The length of the provided gradient vector (2) did not match the number of interpolating dimensions (1)")) do
@test gradient!(Array(Float64, 2), sitp, 2.3, 2)
if VERSION < v"0.5.0-dev" # Test.with_handler was removed in 0.5

# Test error messages for incorrect initialization
function message_is(message)
r -> r.err.msg == message || error("Incorrect error message: expected '$message' but was '$(r.err.msg)'")
end
Test.with_handler(message_is("Must scale 2-dimensional interpolation object with exactly 2 ranges (you used 1)")) do
@test scale(itp, xs)
end
Test.with_handler(message_is("NoInterp dimension 2 must be scaled with unit range 1:3")) do
@test scale(itp, xs, -1:1)
end
Test.with_handler(message_is("The length of the range in dimension 1 (8) did not equal the size of the interpolation object in that direction (11)")) do
@test scale(itp, -pi:2pi/7:pi, 1:3)
end
Test.with_handler(message_is("Must index into 2-dimensional scaled interpolation object with exactly 2 indices (you used 1)")) do
@test sitp[2.3]
end
Test.with_handler(message_is("Must index into 2-dimensional scaled interpolation object with exactly 2 indices (you used 1)")) do
@test gradient(sitp, 2.3)
end
Test.with_handler(message_is("The length of the provided gradient vector (2) did not match the number of interpolating dimensions (1)")) do
@test gradient!(Array(Float64, 2), sitp, 2.3, 2)
end

end

end

0 comments on commit 9a0c98a

Please sign in to comment.