Skip to content

Commit 6922b6f

Browse files
committed
Add Printf
1 parent ad0ddc6 commit 6922b6f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ Currently, the `@compat` macro supports the following syntaxes:
9898
* `using Compat.Unicode` is provided on versions older than 0.7, where this library is not
9999
yet a part of the standard library. ([#25021])
100100

101+
* `using Compat.Printf` is provided on versions older than 0.7, where this library is not
102+
yet a part of the standard library. ([#25056])
103+
101104
## New functions, macros, and methods
102105

103106
* `@views` takes an expression and converts all slices to views ([#20164]), while
@@ -396,3 +399,4 @@ includes this fix. Find the minimum version from there.
396399
[#24785]: https://github.com/JuliaLang/julia/issues/24785
397400
[#25012]: https://github.com/JuliaLang/julia/issues/25012
398401
[#25021]: https://github.com/JuliaLang/julia/issues/25021
402+
[#25056]: https://github.com/JuliaLang/julia/issues/25056

src/Compat.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,12 @@ else
763763
import Dates
764764
end
765765

766+
if VERSION < v"0.7.0-DEV.3052"
767+
const Printf = Base.Printf
768+
else
769+
import Printf
770+
end
771+
766772
# 0.7.0-DEV.1993
767773
@static if !isdefined(Base, :EqualTo)
768774
if VERSION >= v"0.6.0"

test/runtests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,16 @@ module Test24459
902902
@test isdefined(@__MODULE__, :Dates)
903903
end
904904

905+
# 0.7
906+
module Test25056
907+
using Compat
908+
using Compat.Test
909+
using Compat.Printf
910+
@test isdefined(@__MODULE__, :Printf)
911+
@test isdefined(@__MODULE__, Symbol("@printf"))
912+
@test isdefined(@__MODULE__, Symbol("@sprintf"))
913+
end
914+
905915
let a = [0,1,2,3,0,1,2,3]
906916
@test findfirst(equalto(3), [1,2,4,1,2,3,4]) == 6
907917
@test findfirst(!equalto(1), [1,2,4,1,2,3,4]) == 2

0 commit comments

Comments
 (0)