Skip to content

Commit

Permalink
fix empty string error in Printf (#50011)
Browse files Browse the repository at this point in the history
* fix empty string error in Printf

* Update runtests.jl

* Update runtests.jl
  • Loading branch information
aplavin authored Jun 3, 2023
1 parent c3d70e8 commit 0c774c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion stdlib/Printf/src/Printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ end

# parse format string
function Format(f::AbstractString)
isempty(f) && throw(InvalidFormatStringError("Format string must not be empty", f, 1, 1))
bytes = codeunits(f)
len = length(bytes)
pos = 1
Expand Down
5 changes: 4 additions & 1 deletion stdlib/Printf/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ end
@test Printf.@sprintf("1%%2%%3") == "1%2%3"
@test Printf.@sprintf("GAP[%%]") == "GAP[%]"
@test Printf.@sprintf("hey there") == "hey there"
@test_throws Printf.InvalidFormatStringError Printf.Format("")
@test_throws Printf.InvalidFormatStringError Printf.Format("%+")
@test_throws Printf.InvalidFormatStringError Printf.Format("%.")
@test_throws Printf.InvalidFormatStringError Printf.Format("%.0")
Expand Down Expand Up @@ -488,6 +487,10 @@ end
@test @sprintf("%d", 3//1) == "3"
@test @sprintf("%d", Inf) == "Inf"
@test @sprintf(" %d", NaN) == " NaN"

# 50011
@test Printf.@sprintf("") == ""
@test Printf.format(Printf.Format("")) == ""
end

@testset "integers" begin
Expand Down

2 comments on commit 0c774c7

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

Please sign in to comment.