Skip to content

Commit

Permalink
add some tests for argument errors (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicycle1885 authored Aug 1, 2017
1 parent 1e7f36b commit 2d7c331
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ end
end

@testset "Traversal" begin
doc = parsexml("<root/>")
doc = parsexml("<root/>")
@test hasroot(doc)
@test !hasdtd(doc)
@test isa(root(doc), EzXML.Node)
Expand All @@ -460,6 +460,7 @@ end
@test_throws ArgumentError parentnode(doc.node)
@test hasparentnode(root(doc))
@test parentnode(root(doc)) === doc.node
@test_throws ArgumentError name(parentnode(root(doc)))
@test_throws ArgumentError dtd(doc)

doc = parsexml("""
Expand All @@ -480,6 +481,8 @@ end
@test systemID(dtd(doc)) == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
@test externalID(dtd(doc)) == "-//W3C//DTD XHTML 1.0 Transitional//EN"
@test parentnode(dtd(doc)) === doc.node
@test_throws ArgumentError systemID(root(doc))
@test_throws ArgumentError externalID(root(doc))

doc = parse(EzXML.Document, """
<?xml version="1.0"?>
Expand Down Expand Up @@ -549,6 +552,7 @@ end
@test namespace(x) == "http://xxx.com"
@test namespace(attributes(x)[1]) == "http://xxx.com"
@test namespace(attributes(x)[2]) == "http://yyy.com"
@test_throws ArgumentError namespace(parentnode(root(doc)))

# http://www.xml.com/pub/a/1999/01/namespaces.html
doc = parsexml("""
Expand Down

0 comments on commit 2d7c331

Please sign in to comment.