Skip to content

Commit

Permalink
add undefined binding doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolewski committed Dec 16, 2015
1 parent 38c8346 commit 9e2f5dc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ undocumented(x,y) = 3

end

@test docstrings_equal(@doc(Undocumented.bindingdoesnotexist), doc"""
No documentation found.
Binding `Undocumented.bindingdoesnotexist` does not exist.
""")

@test docstrings_equal(@doc(Undocumented.A), doc"""
No documentation found.
Expand Down Expand Up @@ -577,32 +583,47 @@ end
import Base.Docs: @var, Binding

let x = Binding(Base, symbol("@time"))
@test x.defined == true
@test @var(@time) == x
@test @var(Base.@time) == x
@test @var(Base.Pkg.@time) == x
end

let x = Binding(Base.LinAlg, :norm)
@test x.defined == true
@test @var(norm) == x
@test @var(Base.norm) == x
@test @var(Base.LinAlg.norm) == x
@test @var(Base.Pkg.Dir.norm) == x
end

let x = Binding(Core, :Int)
@test x.defined == true
@test @var(Int) == x
@test @var(Base.Int) == x
@test @var(Core.Int) == x
@test @var(Base.Pkg.Resolve.Int) == x
end

let x = Binding(Base, :Pkg)
@test x.defined == true
@test @var(Pkg) == x
@test @var(Base.Pkg) == x
@test @var(Main.Pkg) == x
end

let x = Binding(Base, :VERSION)
@test x.defined == true
@test @var(VERSION) == x
@test @var(Base.VERSION) == x
end

let x = Binding(Base, :bindingdoesnotexist)
@test x.defined == false
@test @var(Base.bindingdoesnotexist) == x
end

let x = Binding(Main, :bindingdoesnotexist)
@test x.defined == false
@test @var(bindingdoesnotexist) == x
end

0 comments on commit 9e2f5dc

Please sign in to comment.