Skip to content

Commit 44882d5

Browse files
committed
Return nothing from printfmt
1 parent 37b5c92 commit 44882d5

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

src/fmtspec.jl

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ function printfmt(io::IO, fs::FormatSpec, x)
214214
else # cls == 'c'
215215
_pfmt_s(io, fs, Char(x))
216216
end
217+
nothing
217218
end
218219

219220
printfmt(fs::FormatSpec, x) = printfmt(_stdout(), fs, x)

src/formatexpr.jl

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function printfmt(io::IO, fe::FormatExpr, args...)
151151
end
152152
end
153153
isempty(fe.suffix) || print(io, fe.suffix)
154+
nothing
154155
end
155156

156157
const StringOrFE = Union{AbstractString, FormatExpr}

test/fmtspec.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ end
223223
# May need to change how separators are handled with zero padding,
224224
# to produce the same results as Python
225225

226-
# @test pyfmt("08,d", 1234) == "0,001,234"
227-
# @test pyfmt("09,d", 1234) == "0,001,234"
228-
# @test pyfmt("010,d", 1234) == "00,001,234"
226+
@test_broken pyfmt("08,d", 1234) == "0,001,234"
227+
@test_broken pyfmt("09,d", 1234) == "0,001,234"
228+
@test_broken pyfmt("010,d", 1234) == "00,001,234"
229229

230230
@test pyfmt("+#012_b", 42) == "+0b0010_1010"
231-
# @test pyfmt("+#013_b", 42) == "+0b0_0010_1010"
232-
# @test pyfmt("+#014_b", 42) == "+0b0_0010_1010"
231+
@test_broken pyfmt("+#013_b", 42) == "+0b0_0010_1010"
232+
@test_broken pyfmt("+#014_b", 42) == "+0b0_0010_1010"
233233

234234
end
235235

test/formatexpr.jl

+8-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@
3434
@test_throws(ErrorException, format("{1", 10) )
3535

3636
f = FormatExpr("{1:s}")
37-
printfmt(f,"")
38-
printfmtln(f,"")
37+
printfmt(f, "")
38+
printfmtln(f, "")
3939
io = IOBuffer()
40-
printfmt(io,f,"foobar")
40+
printfmt(io, f, "foobar")
4141
@test io.size == 6
42-
printfmtln(io,f,"ugly")
42+
printfmtln(io, f, "ugly")
4343
@test io.size == 11
44+
45+
# Issue #81
46+
@test printfmt("{:d}", 1000) == nothing
47+
4448
end
4549

4650
@testset "format escape {{ and }}" begin

0 commit comments

Comments
 (0)