@@ -24,47 +24,46 @@ const JL = JuliaLowering
2424 @test Core. eval (test_mod, lwr) === 2
2525 end
2626
27- if isdefined (Core, :_lower )
28- function jeval (str)
29- prog = parseall (Expr, str)
30- local out
31- try
32- JL. activate! ()
33- out = Core. eval (test_mod, prog)
34- finally
35- JL. activate! (false )
36- end
27+ function jeval (str)
28+ prog = parseall (Expr, str)
29+ local out
30+ try
31+ JL. activate! ()
32+ out = Core. eval (test_mod, prog)
33+ finally
34+ JL. activate! (false )
3735 end
38- @testset " integration: `JuliaLowering.activate!`" begin
39- out = jeval (" global asdf = 1" )
40- @test out === 1
41- @test isdefined (test_mod, :asdf )
36+ end
37+ @testset " integration: `JuliaLowering.activate!`" begin
38+ out = jeval (" global asdf = 1" )
39+ @test out === 1
40+ @test isdefined (test_mod, :asdf )
4241
43- out = jeval (" module M; x = 1; end" )
44- @test out isa Module
45- @test isdefined (test_mod, :M )
46- @test isdefined (test_mod. M, :x )
42+ out = jeval (" module M; x = 1; end" )
43+ @test out isa Module
44+ @test isdefined (test_mod, :M )
45+ @test isdefined (test_mod. M, :x )
4746
48- @test jeval (" @ccall jl_value_ptr(nothing::Any)::Ptr{Cvoid}" ) isa Ptr{Cvoid}
47+ @test jeval (" @ccall jl_value_ptr(nothing::Any)::Ptr{Cvoid}" ) isa Ptr{Cvoid}
4948
50- # Tricky cases with symbols
51- out = jeval (""" module M2
49+ # Tricky cases with symbols
50+ out = jeval (""" module M2
5251 Base.@constprop :aggressive function f(x); x; end
5352 const what = ccall(:jl_value_ptr, Ptr{Cvoid}, (Any,), Core.nothing)
5453 end""" )
55- @test out isa Module
56- @test isdefined (test_mod, :M2 )
57- @test isdefined (test_mod. M2, :f )
58- @test isdefined (test_mod. M2, :what )
54+ @test out isa Module
55+ @test isdefined (test_mod, :M2 )
56+ @test isdefined (test_mod. M2, :f )
57+ @test isdefined (test_mod. M2, :what )
5958
60- out = jeval (""" "docstring" module M3 end """ )
61- @test out isa Module
62- @test isdefined (test_mod, :M3 )
59+ out = jeval (""" "docstring" module M3 end """ )
60+ @test out isa Module
61+ @test isdefined (test_mod, :M3 )
6362
64- # Macros may produce toplevel expressions. Note that julia handles
65- # this case badly (macro expansion replaces M5_inner with a
66- # globalref) and we handle esc(:M5_inner) badly
67- out = jeval (""" module M5
63+ # Macros may produce toplevel expressions. Note that julia handles
64+ # this case badly (macro expansion replaces M5_inner with a
65+ # globalref) and we handle esc(:M5_inner) badly
66+ out = jeval (""" module M5
6867 macro newmod()
6968 return quote
7069 let a = 1
@@ -76,13 +75,11 @@ const JL = JuliaLowering
7675 end
7776 @newmod()
7877 end""" )
79- @test out isa Module
80- @test isdefined (test_mod, :M5 )
81- @test isdefined (test_mod. M5, :M5_inner )
82- @test isdefined (test_mod. M5. M5_inner, :asdf )
78+ @test out isa Module
79+ @test isdefined (test_mod, :M5 )
80+ @test isdefined (test_mod. M5, :M5_inner )
81+ @test isdefined (test_mod. M5. M5_inner, :asdf )
8382
84- # TODO : broken, commented to prevent error logging
85- # @test jeval("Base.@propagate_inbounds @inline meta_double_quote_issue(x) = x") isa Function
86- end
83+ @test jeval (" Base.@propagate_inbounds @inline meta_double_quote_issue(x) = x" ) isa Function
8784 end
8885end
0 commit comments