Browse Source

Fix single line module

pull/19/head
Fredrik Ekre 1 year ago
parent
commit
1568852e3f
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 4
      src/runestone.jl
  2. 2
      test/runtests.jl

4
src/runestone.jl

@ -2176,8 +2176,8 @@ function indent_module(ctx::Context, node::Node) @@ -2176,8 +2176,8 @@ function indent_module(ctx::Context, node::Node)
kids[block_idx] = block_node′
any_kid_changed = true
end
# Fifth node is the closing end keyword
end_idx = 5
# Skip until the closing end keyword
end_idx = findnext(x -> kind(x) === K"end", kids, block_idx + 1)
end_node = kids[end_idx]
@assert is_leaf(end_node) && kind(end_node) === K"end"
if !has_tag(end_node, TAG_DEDENT)

2
test/runtests.jl

@ -594,6 +594,8 @@ end @@ -594,6 +594,8 @@ end
# var"" as module name
@test format_string("$(b)module var\"A\"\n$(sp)x\n$(sp)end\nf") ==
"$(b)module var\"A\"\n x\nend\nf"
# single line module
@test format_string("$(b)module A; x; end\nf") == "$(b)module A; x; end\nf"
end
# tuple
@test format_string("(a,\n$(sp)b)") == "(\n a,\n b,\n)"

Loading…
Cancel
Save