diff --git a/.drone.yml b/.drone.yml index b2771d5..d5da3da 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,20 +1,6 @@ --- kind: pipeline -name: linux - arm - Julia 1.0 - -platform: - os: linux - arch: arm - -steps: -- name: build - image: julia:1.0 - commands: - - "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'" - ---- -kind: pipeline -name: linux - arm64 - Julia 1.0 +name: linux - arm64 - Julia 1.5 platform: os: linux @@ -22,13 +8,13 @@ platform: steps: - name: build - image: julia:1.0 + image: julia:1.5 commands: - "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'" --- kind: pipeline -name: linux - arm64 - Julia 1.5 +name: linux - arm64 - Julia 1.6 platform: os: linux @@ -36,6 +22,6 @@ platform: steps: - name: build - image: julia:1.5 + image: julia:1.6 commands: - "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ea042c9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -## Documentation: http://docs.travis-ci.com/user/languages/julia/ -language: julia -os: - - linux - - osx - - windows -julia: - - 1.0 - - 1 - - nightly -notifications: - email: false -git: - depth: 99999999 - -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) -matrix: - allow_failures: - - julia: nightly - -after_success: - - julia -e 'using Pkg; cd(Pkg.dir("Format")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/Project.toml b/Project.toml index 9b4d0e7..200df45 100644 --- a/Project.toml +++ b/Project.toml @@ -23,7 +23,7 @@ keywords = ["Strings", "Formatting"] license = "MIT" name = "Format" uuid = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8" -version = "1.3.0" +version = "1.3.1" [deps] diff --git a/src/printf.jl b/src/printf.jl index a5af3ae..cfe7412 100644 --- a/src/printf.jl +++ b/src/printf.jl @@ -209,9 +209,9 @@ function _fmt(buf, pos, spec::FmtSpec{FmtChr}, arg) width = spec.width - 1 width <= 0 && return writechar(buf, pos, ch) if spec.leftalign - writechar(buf, padn(buf, pos, width), ch) - else padn(buf, writechar(buf, pos, ch), width) + else + writechar(buf, padn(buf, pos, width), ch) end end diff --git a/test/speedtest.jl b/test/speedtest.jl index 7a02d09..ae17aa3 100644 --- a/test/speedtest.jl +++ b/test/speedtest.jl @@ -7,12 +7,14 @@ function native_int() @sprintf( "%10d", i ) end end +@static if VERSION >= v"1.6" function format_int() fmt = Printf.Format( "%10d" ) for i in 1:BENCH_REP Printf.format( fmt, i ) end end +end function runtime_int() for i in 1:BENCH_REP cfmt( "%10d", i ) @@ -33,8 +35,10 @@ end println( "integer @sprintf speed") @time native_int() -println( "integer format speed") -@time format_int() +@static if VERSION >= v"1.6" + println( "integer format speed") + @time format_int() +end println( "integer cfmt speed") @time runtime_int() println( "integer cfmt spec speed") @@ -50,12 +54,14 @@ function native_float() @sprintf( "%10.4f", v) end end +@static if VERSION >= v"1.6" function format_float() fmt = Printf.Format( "%10.4f" ) for v in testflts Printf.format( fmt, v ) end end +end function runtime_float() for v in testflts cfmt( "%10.4f", v) @@ -77,8 +83,10 @@ end println() println( "float64 @sprintf speed") @time native_float() +@static if VERSION >= v"1.6" println( "float64 format speed") @time format_float() +end println( "float64 cfmt speed") @time runtime_float() println( "float64 cfmt spec speed")