Browse Source

Tests for newline stripping

pull/19/head
Fredrik Ekre 2 years ago
parent
commit
e12233cd4e
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 9
      src/Runic.jl
  2. 12
      test/runtests.jl

9
src/Runic.jl

@ -424,15 +424,6 @@ function format_tree!(ctx::Context)
return nothing return nothing
end 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 format_string(str::AbstractString) -> String

12
test/runtests.jl

@ -1,7 +1,17 @@
using Runic: using Runic:
format_string format_string
using Test: 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 @testset "Hex/oct/bin literal integers" begin
z(n) = "0"^n z(n) = "0"^n

Loading…
Cancel
Save