Skip to content

Commit ccaa9a7

Browse files
committed
Workaround for weird issue
1 parent 4253023 commit ccaa9a7

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

test/constraint.jl

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,31 @@ end
114114
function test_errors(var)
115115
x = MP.similar_variable(var, Val{:x})
116116
y = MP.similar_variable(var, Val{:y})
117-
m = Model()
118-
setpolymodule!(m, DummyPolyModule)
119-
@variable m α
120-
@variable m β
117+
model = Model()
118+
setpolymodule!(model, DummyPolyModule)
119+
@variable model α
120+
@variable model β
121121
p = α * x * y + β * x^2
122122
q = α * x^2 + β * x * y + α * y^2
123-
@test_throws_parsetime ErrorException @constraint(m, p)
124-
@test_throws_parsetime ErrorException @constraint(m, begin
123+
@test_throws_parsetime ErrorException @constraint(model, p)
124+
@test_throws_parsetime ErrorException @constraint(model, begin
125125
p >= 0
126126
end)
127-
@test_throws_parsetime ErrorException @constraint(m, +(p, p, p))
128-
@test_throws_parsetime ErrorException @constraint(m, p >= 0, 1)
129-
#@test_throws_parsetime ErrorException @constraint(m, p >= 0, domain = (@set x >= -1 && x <= 1, domain = y >= -1 && y <= 1))
127+
@test_throws_parsetime ErrorException @constraint(model, +(p, p, p))
128+
# FIXME I get a `model` not defined with the following line
129+
# so I just manually did the `@test_throws_parsetime`
130+
# @test_throws_parsetime ErrorException @constraint(model, p >= 0, 1),
131+
@test_throws(
132+
ErrorException,
133+
try
134+
@constraint(model, p >= 0, 1)
135+
catch err
136+
throw(_strip_line_from_error(err))
137+
end
138+
)
139+
#@test_throws_parsetime ErrorException @constraint(model, p >= 0, domain = (@set x >= -1 && x <= 1, domain = y >= -1 && y <= 1))
130140
@test_throws_parsetime ErrorException @constraint(
131-
m,
141+
model,
132142
p + 0,
133143
domain = (@set x >= -1 && x <= 1)
134144
)

0 commit comments

Comments
 (0)