|
29 | 29 | end
|
30 | 30 | end
|
31 | 31 | end
|
32 |
| - modexs = collect(ExprSplitter(Main, ex)) |
33 |
| - m, ex = first(modexs) |
| 32 | + modexs = collect(ExprSplitter(JIVisible, ex)) |
| 33 | + m, ex = first(modexs) # FIXME don't use index in tests |
34 | 34 | @test JuliaInterpreter.is_doc_expr(ex.args[2])
|
35 | 35 | Core.eval(m, ex)
|
36 | 36 | io = IOBuffer()
|
37 |
| - show(io, @doc(Main.DocStringTest)) |
| 37 | + show(io, @doc(JIVisible.DocStringTest)) |
38 | 38 | @test occursin("Special", String(take!(io)))
|
| 39 | + |
| 40 | + ex = Base.parse_input_line(""" |
| 41 | + "docstring" |
| 42 | + module OuterModDocstring |
| 43 | + "docstring for InnerModDocstring" |
| 44 | + module InnerModDocstring |
| 45 | + end |
| 46 | + end |
| 47 | + """) |
| 48 | + modexs = collect(ExprSplitter(JIVisible, ex)) |
| 49 | + @test isdefined(JIVisible, :OuterModDocstring) |
| 50 | + @test isdefined(JIVisible.OuterModDocstring, :InnerModDocstring) |
| 51 | + |
39 | 52 | # issue #538
|
40 | 53 | @test !JuliaInterpreter.is_doc_expr(:(Core.@doc "string"))
|
41 | 54 | ex = quote
|
|
44 | 57 | sum
|
45 | 58 | end
|
46 | 59 | modexs = collect(ExprSplitter(Main, ex))
|
47 |
| - m, ex = first(modexs) |
| 60 | + m, ex = first(modexs) # FIXME don't use index in tests |
48 | 61 | @test !JuliaInterpreter.is_doc_expr(ex.args[2])
|
49 | 62 |
|
50 | 63 | @test !isdefined(Main, :JIInvisible)
|
51 |
| - collect(ExprSplitter(JIVisible, :(module JIInvisible f() = 1 end))) |
| 64 | + collect(ExprSplitter(JIVisible, :(module JIInvisible f() = 1 end))) # this looks up JIInvisible rather than create it |
52 | 65 | @test !isdefined(Main, :JIInvisible)
|
53 | 66 | @test isdefined(JIVisible, :JIInvisible)
|
54 | 67 | mktempdir() do path
|
|
71 | 84 | # Every package is technically parented in Main but the name may not be visible in Main
|
72 | 85 | @test isdefined(@__MODULE__, :TmpPkg1)
|
73 | 86 | @test !isdefined(@__MODULE__, :TmpPkg2)
|
74 |
| - collect(ExprSplitter(Main, quote |
75 |
| - module TmpPkg2 |
76 |
| - f() = 2 |
77 |
| - end |
78 |
| - end)) |
| 87 | + collect(ExprSplitter(@__MODULE__, quote |
| 88 | + module TmpPkg2 |
| 89 | + f() = 2 |
| 90 | + end |
| 91 | + end)) |
79 | 92 | @test isdefined(@__MODULE__, :TmpPkg1)
|
80 | 93 | @test !isdefined(@__MODULE__, :TmpPkg2)
|
81 | 94 | end
|
| 95 | + |
| 96 | + # Revise issue #718 |
| 97 | + ex = Base.parse_input_line(""" |
| 98 | + module TestPkg718 |
| 99 | +
|
| 100 | + module TestModule718 |
| 101 | + export _VARIABLE_UNASSIGNED |
| 102 | + global _VARIABLE_UNASSIGNED = -84.0 |
| 103 | + end |
| 104 | +
|
| 105 | + using .TestModule718 |
| 106 | +
|
| 107 | + end |
| 108 | + """) |
| 109 | + for (mod, ex) in ExprSplitter(JIVisible, ex) |
| 110 | + @test JuliaInterpreter.finish!(Frame(mod, ex), true) === nothing |
| 111 | + end |
| 112 | + @test JIVisible.TestPkg718._VARIABLE_UNASSIGNED == -84.0 |
82 | 113 | end
|
83 | 114 |
|
84 | 115 | module Toplevel end
|
|
495 | 526 |
|
496 | 527 | @testset "Recursive type definitions" begin
|
497 | 528 | # See https://github.com/timholy/Revise.jl/issues/417
|
| 529 | + # See also the `Node` test above |
498 | 530 | ex = :(struct RecursiveType x::Vector{RecursiveType} end)
|
499 | 531 | frame = Frame(Toplevel, ex)
|
500 | 532 | JuliaInterpreter.finish!(frame, true)
|
|
523 | 555 | sin(foo)
|
524 | 556 | end)
|
525 | 557 | for (mod, ex) in ExprSplitter(@__MODULE__, ex)
|
526 |
| - @test JuliaInterpreter.finish!(Frame(mod, ex), true) === nothing |
| 558 | + @test JuliaInterpreter.finish_and_return!(Frame(mod, ex), true) == sin(10) |
527 | 559 | end
|
528 |
| - @test length(collect(ExprSplitter(@__MODULE__, ex))) == 1 |
| 560 | + |
529 | 561 | ex = :(begin
|
530 | 562 | 3 + 7
|
531 | 563 | module Local
|
|
534 | 566 | end
|
535 | 567 | end)
|
536 | 568 | modexs = collect(ExprSplitter(@__MODULE__, ex))
|
537 |
| - @test length(modexs) == 2 |
| 569 | + @test length(modexs) == 2 # FIXME don't use index in tests |
538 | 570 | @test modexs[2][1] == getfield(@__MODULE__, :Local)
|
539 | 571 | for (mod, ex) in modexs
|
540 | 572 | @test JuliaInterpreter.finish!(Frame(mod, ex), true) === nothing
|
|
560 | 592 | for (mod, ex) in modexs
|
561 | 593 | @test JuliaInterpreter.finish!(Frame(mod, ex), true) === nothing
|
562 | 594 | end
|
563 |
| - @test length(modexs) == 2 |
| 595 | + @test length(modexs) == 2 # FIXME don't use index in tests |
564 | 596 |
|
565 | 597 | ex = Base.parse_input_line("""
|
566 | 598 | local foo = 10
|
|
570 | 602 | for (mod, ex) in modexs
|
571 | 603 | @test JuliaInterpreter.finish!(Frame(mod, ex), true) === nothing
|
572 | 604 | end
|
573 |
| - @test length(modexs) == 2 |
| 605 | + @test length(modexs) == 2 # FIXME don't use index in tests |
574 | 606 | end
|
0 commit comments