Skip to content

Commit

Permalink
Add a broken test for lowering of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Feb 14, 2019
1 parent 997e3f6 commit 8d24c64
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/toplevel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ module Toplevel end
@test Toplevel.Testing.JuliaStackFrame === JuliaStackFrame
end

@testset "Enum" begin
ex = quote
@enum MPFRRoundingMode begin
MPFRRoundNearest
MPFRRoundToZero
MPFRRoundUp
MPFRRoundDown
MPFRRoundFromZero
MPFRRoundFaithful
end
end
frame = JuliaInterpreter.prepare_toplevel(Toplevel, ex)
@test_broken JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true)
end

module LowerAnon
ret = Ref{Any}(nothing)
end
Expand All @@ -176,4 +191,18 @@ end
lower_incrementally(runtest, LowerAnon, ex2)
@test isa(LowerAnon.ret[], Vector{Int16})
LowerAnon.ret[] = nothing

ex3 = quote
const BitIntegerType = Union{map(T->Type{T}, Base.BitInteger_types)...}
end
lower_incrementally(runtest, LowerAnon, ex3)
@test isa(LowerAnon.BitIntegerType, Union)

ex4 = quote
y = 3
z = map(x->x^2+y, [1,2,3])
y = 4
end
lower_incrementally(runtest, LowerAnon, ex4)
@test LowerAnon.z == [4,7,12]
end

0 comments on commit 8d24c64

Please sign in to comment.