Skip to content

Commit 69eb50a

Browse files
authored
Update signatures and CI config for 0.7/1.0. (#64)
1 parent dcb8c2a commit 69eb50a

File tree

5 files changed

+73
-43
lines changed

5 files changed

+73
-43
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ sudo: false
99
julia:
1010
- 0.6
1111
- 0.7
12+
- 1.0
1213
- nightly
1314

1415
notifications:

appveyor.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
6-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
7-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
8-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
3+
- julia_version: 0.6
4+
- julia_version: 0.7
5+
- julia_version: 1
6+
- julia_version: nightly
7+
8+
platform:
9+
- x86 # 32-bit
10+
- x64 # 64-bit
11+
12+
# # Uncomment the following lines to allow failures on nightly julia
13+
# # (tests will run but not make your overall status red)
14+
# matrix:
15+
# allow_failures:
16+
# - julia_version: latest
917

1018
branches:
1119
only:
@@ -19,19 +27,18 @@ notifications:
1927
on_build_status_changed: false
2028

2129
install:
22-
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
23-
# Download most recent Julia Windows binary
24-
- ps: (new-object net.webclient).DownloadFile(
25-
$env:JULIA_URL,
26-
"C:\projects\julia-binary.exe")
27-
# Run installer silently, output to C:\projects\julia
28-
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
30+
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
2931

3032
build_script:
31-
# Need to convert from shallow to complete for Pkg.clone to work
32-
- IF EXIST .git\shallow (git fetch --unshallow)
33-
- C:\projects\julia\bin\julia -e "versioninfo();
34-
Pkg.clone(pwd(), \"DocStringExtensions\"); Pkg.build(\"DocStringExtensions\")"
33+
- echo "%JL_BUILD_SCRIPT%"
34+
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
3535

3636
test_script:
37-
- C:\projects\julia\bin\julia -e "Pkg.test(\"DocStringExtensions\")"
37+
- echo "%JL_TEST_SCRIPT%"
38+
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
39+
40+
# # Uncomment to support code coverage upload. Should only be enabled for packages
41+
# # which would have coverage gaps without running on Windows
42+
# on_success:
43+
# - echo "%JL_CODECOV_SCRIPT%"
44+
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"

src/abbreviations.jl

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -352,26 +352,56 @@ struct MyType{S, T<:Integer} <: AbstractArray
352352
"""
353353
const TYPEDEF = TypeDefinition()
354354

355+
function print_supertype(buf, object)
356+
super = supertype(object)
357+
super != Any && print(buf, " <: ", super)
358+
end
359+
360+
function print_params(buf, object)
361+
if !isempty(object.parameters)
362+
print(buf, "{")
363+
join(buf, object.parameters, ", ")
364+
print(buf, "}")
365+
end
366+
end
367+
368+
function print_primitive_type(buf, object)
369+
print(buf, "primitive type ", object.name.name)
370+
print_supertype(buf, object)
371+
print(buf, " ", sizeof(object) * 8)
372+
println(buf)
373+
end
374+
375+
function print_abstract_type(buf, object)
376+
print(buf, "abstract type ", object.name.name)
377+
print_supertype(buf, object)
378+
println(buf)
379+
end
380+
381+
function print_mutable_struct_or_struct(buf, object)
382+
object.mutable && print(buf, "mutable ")
383+
print(buf, "struct ", object.name.name)
384+
print_params(buf, object)
385+
print_supertype(buf, object)
386+
println(buf)
387+
end
388+
389+
@static if VERSION < v"0.7.0"
390+
isprimitivetype(x) = isbitstype(x)
391+
end
392+
355393
function format(::TypeDefinition, buf, doc)
356394
local binding = doc.data[:binding]
357395
local object = gettype(Docs.resolve(binding))
358396
if isa(object, DataType)
359397
println(buf, "\n```julia")
360-
if isbitstype(object)
361-
print(buf, "bitstype ", sizeof(object) * 8, " ")
398+
if isprimitivetype(object)
399+
print_primitive_type(buf, object)
362400
elseif isabstracttype(object)
363-
print(buf, "abstract ")
401+
print_abstract_type(buf, object)
364402
else
365-
print(buf, object.mutable ? "type " : "struct ")
366-
end
367-
print(buf, object.name.name)
368-
if !isempty(object.parameters)
369-
print(buf, "{")
370-
join(buf, object.parameters, ", ")
371-
print(buf, "}")
403+
print_mutable_struct_or_struct(buf, object)
372404
end
373-
local super = supertype(object)
374-
super == Any ? println(buf) : println(buf, " <: ", super)
375405
println(buf, "```\n")
376406
end
377407
end

src/utilities.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ url(m::Method) = url(m.module, string(m.file), m.line)
312312
import Compat.LibGit2
313313

314314
function url(mod::Module, file::AbstractString, line::Integer)
315-
file = Compat.Sys.iswindows() ? replace(file, '\\', '/') : file
315+
file = Compat.Sys.iswindows() ? replace(file, '\\' => '/') : file
316316
if Base.inbase(mod) && !isabspath(file)
317317
local base = "https://github.com/JuliaLang/julia/tree"
318318
if isempty(Base.GIT_VERSION_INFO.commit)

test/tests.jl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ end
195195
)
196196
DSE.format(TYPEDEF, buf, doc)
197197
str = String(take!(buf))
198-
@test occursin("\n```julia\n", str)
199-
@test occursin("\nabstract AbstractType <: Integer\n", str)
200-
@test occursin("\n```\n", str)
198+
@test str == "\n```julia\nabstract type AbstractType <: Integer\n```\n\n"
201199

202200
doc.data = Dict(
203201
:binding => Docs.Binding(M, :CustomType),
@@ -206,9 +204,7 @@ end
206204
)
207205
DSE.format(TYPEDEF, buf, doc)
208206
str = String(take!(buf))
209-
@test occursin("\n```julia\n", str)
210-
@test occursin("\nstruct CustomType{S, T<:Integer} <: Integer\n", str)
211-
@test occursin("\n```\n", str)
207+
@test str == "\n```julia\nstruct CustomType{S, T<:Integer} <: Integer\n```\n\n"
212208

213209
doc.data = Dict(
214210
:binding => Docs.Binding(M, :BitType8),
@@ -217,9 +213,7 @@ end
217213
)
218214
DSE.format(TYPEDEF, buf, doc)
219215
str = String(take!(buf))
220-
@test occursin("\n```julia\n", str)
221-
@test occursin("\nbitstype 8 BitType8\n", str)
222-
@test occursin("\n```\n", str)
216+
@test str == "\n```julia\nprimitive type BitType8 8\n```\n\n"
223217

224218
doc.data = Dict(
225219
:binding => Docs.Binding(M, :BitType32),
@@ -228,9 +222,7 @@ end
228222
)
229223
DSE.format(TYPEDEF, buf, doc)
230224
str = String(take!(buf))
231-
@test occursin("\n```julia\n", str)
232-
@test occursin("\nbitstype 32 BitType32 <: Real", str)
233-
@test occursin("\n```\n", str)
225+
@test str == "\n```julia\nprimitive type BitType32 <: Real 32\n```\n\n"
234226
end
235227
end
236228
@testset "templates" begin

0 commit comments

Comments
 (0)