Skip to content

Commit aeb8e30

Browse files
aplavinScottPJones
authored andcommitted
Format Symbols without leading colon Formatting PR #100
1 parent 049297d commit aeb8e30

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/fmtspec.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ mutable struct _Bin end
162162

163163
_srepr(x) = repr(x)
164164
_srepr(x::AbstractString) = x
165+
_srepr(x::Symbol) = string(x)
165166
_srepr(x::AbstractChar) = string(x)
166167
_srepr(x::Enum) = string(x)
167168

test/fmtspec.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@test fs.tsep == false
1515
end
1616

17-
_contains(s, r) = @static VERSION < v"0.7.0-DEV" ? contains(s, r) : occursin(r, s)
17+
_contains(s, r) = occursin(r, s)
1818

1919
@testset "Show" begin
2020
x = FormatSpec("#8,d")
@@ -72,6 +72,11 @@ end
7272
@test pyfmt("⋆<5s", "αβγ") == "αβγ⋆⋆"
7373
end
7474

75+
@testset "Format Symbol" begin
76+
@test pyfmt("", :abc) == "abc"
77+
@test pyfmt("s", :abc) == "abc"
78+
end
79+
7580
@testset "Format Char" begin
7681
@test pyfmt("", 'c') == "c"
7782
@test pyfmt("", 'γ') == "γ"

0 commit comments

Comments
 (0)