diff --git a/src/runestone.jl b/src/runestone.jl index 71d3b9c..4415f89 100644 --- a/src/runestone.jl +++ b/src/runestone.jl @@ -981,7 +981,7 @@ function spaces_in_export_public(ctx::Context, node::Node) state = :expect_identifier end if kind(kid) === K"$" - @assert findlast(x -> x === K"quote", ctx.lineage_kinds) !== nothing + @assert findlast(x -> x in KSet"quote macrocall", ctx.lineage_kinds) !== nothing end elseif kind(kid) in KSet"Comment NewlineWs" any_changes && push!(kids′, kid) diff --git a/test/runtests.jl b/test/runtests.jl index c8a8acf..b6bf8a1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -836,9 +836,10 @@ end @test format_string("$(verb) \n$(a)$(sp),\n$(b)") == "$(verb)\n $(a),\n $(b)" @test format_string("$(verb) $(a)$(sp),\n# b\n$(b)") == "$(verb) $(a),\n # b\n $(b)" end - # Interpolated identifiers (currently only expected in K"quote") + # Interpolated identifiers (currently only expected in K"quote" and K"macrocall") @test format_string(":(export \$a)") == ":(export \$a)" @test format_string("quote\nexport \$a, \$b\nend") == "quote\n export \$a, \$b\nend" + @test format_string("@eval export \$a") == "@eval export \$a" @test_throws Exception format_string("export \$a") # Non-identifiers @test format_string("export ^, var\"x\"") == "export ^, var\"x\""