Skip to content

Commit

Permalink
Fix spaces around assignment with non-trivia operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 29, 2024
1 parent 4912ba7 commit b2b3e90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/runestone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function spaces_around_operators(ctx::Context, node::JuliaSyntax.GreenNode)
end

function spaces_around_assignments(ctx::Context, node::JuliaSyntax.GreenNode)
if !(is_assignment(node) && !JuliaSyntax.is_trivia(node))
if !(is_assignment(node) && !is_leaf(node) )
return nothing
end
# for-loop nodes are of kind K"=" even when `in` or `∈` is used so we need to
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ end
op == "in" && sp == "" && continue
@test format_string("for i$(sp)$(op)$(sp)1:10\nend\n") == "for i $(op) 1:10\nend\n"
end
# Quoted assignment operators
@test format_string(":(=)") == ":(=)"
@test format_string(":(+=)") == ":(+=)"
end

@testset "whitespace around <: and >:, no whitespace around ::" begin
Expand Down

0 comments on commit b2b3e90

Please sign in to comment.