From 05b9d5bc96ac2df7d499adc4c87385765f0c74d4 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sat, 25 May 2024 02:28:03 +0200 Subject: [PATCH] Tests for newline stripping --- src/Runic.jl | 9 --------- test/runtests.jl | 12 +++++++++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Runic.jl b/src/Runic.jl index 1199340..8961221 100644 --- a/src/Runic.jl +++ b/src/Runic.jl @@ -424,15 +424,6 @@ function format_tree!(ctx::Context) return nothing end -# function format_context(ctx) -# # Build the context -# ctx = Context(sourcetext) -# # Run the formatter -# fmt_tree = format_tree!(ctx) -# ctx.fmt_tree = fmt_tree -# return ctx -# end - """ format_string(str::AbstractString) -> String diff --git a/test/runtests.jl b/test/runtests.jl index 6f177f1..105e074 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,17 @@ using Runic: format_string using Test: - @test, @testset + @test, @testset, @test_broken + +@testset "Trailing whitespace" begin + io = IOBuffer() + println(io, "a = 1 ") # Trailing space + println(io, "b = 2\t") # Trailing tab + println(io, " ") # Trailing space on consecutive lines + println(io, " ") + str = String(take!(io)) + @test_broken format_string(str) == "a = 1\nb = 2\n\n\n" +end @testset "Hex/oct/bin literal integers" begin z(n) = "0"^n