Skip to content

Commit

Permalink
Merge pull request #18 from rdeits/hygiene
Browse files Browse the repository at this point in the history
fix a missing esc()
  • Loading branch information
rdeits authored Aug 16, 2017
2 parents 6bdfe7b + 87a6d3e commit 4e27315
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,5 @@ branches:
#script:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("ConditionalJuMP"); Pkg.test("ConditionalJuMP"; coverage=true)'
after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("ConditionalJuMP")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("ConditionalJuMP")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
2 changes: 1 addition & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function _conditionalize_recursive!(ex::Expr)
ex.args[i] = _conditionalize_recursive!(ex.args[i])
end
if !(ex.args[1] (:(=>),))
Expr(:call, :_conditional, ex.args[1], ex.args[2:end]...)
Expr(:call, :_conditional, esc(ex.args[1]), ex.args[2:end]...)
else
Expr(:call, ex.args...)
end
Expand Down
17 changes: 17 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ using JuMP
using Cbc
using Base.Test

# Macro hygiene
module MacroHygieneTest

using Base.Test
using ConditionalJuMP

function f(x)
x + 1
end

@testset "macro hygiene" begin
x = 5
@test @?(f(x) <= 0) == false
end

end

@testset "bounds" begin
m = Model()
@variable m 1 <= x <= 3
Expand Down

0 comments on commit 4e27315

Please sign in to comment.