Skip to content

Commit

Permalink
cleaned up spec, and bad-bagid test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
tommorris committed Oct 16, 2008
1 parent 7991c71 commit b43fbbd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
3 changes: 3 additions & 0 deletions lib/rena/rdfxmlparser.rb
Expand Up @@ -48,6 +48,9 @@ def fail_check(el)
if el.attributes.get_attribute_ns(SYNTAX_BASE, "aboutEachPrefix")
raise Rena::AboutEachException
end
if el.attributes.get_attribute_ns(SYNTAX_BASE, "bagID")
raise "Bad BagID" unless el.attributes.get_attribute_ns(SYNTAX_BASE, "bagID").value =~ /^[a-zA-Z_][a-zA-Z0-9]*$/
end
end

def parse_subject(el)
Expand Down
29 changes: 14 additions & 15 deletions spec/parser_spec.rb
Expand Up @@ -250,10 +250,9 @@
</rdf:RDF>
EOF

# lambda do
lambda do
graph = RdfXmlParser.new(sampledoc)
print graph.graph.to_ntriples
# end.should_not raise_error
end.should_not raise_error
end

# it "should pass rdfms-syntax-incomplete/test003.rdf" do
Expand Down Expand Up @@ -299,18 +298,18 @@
# pending
# end
#
# it "detect bad bagIDs" do
# sampledoc = <<-EOF;
# <?xml version="1.0" ?>
# <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
# <rdf:Description rdf:bagID='333-555-666' />
# </rdf:RDF>
# EOF
#
# lambda do
# graph = RdfXmlParser.new(sampledoc)
# end.should raise_error
# end
it "detect bad bagIDs" do
sampledoc = <<-EOF;
<?xml version="1.0" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:bagID='333-555-666' />
</rdf:RDF>
EOF

lambda do
graph = RdfXmlParser.new(sampledoc)
end.should raise_error
end
# describe "parsing rdf files" do
# def test_file(filepath, uri = nil)
# n3_string = File.read(filepath)
Expand Down

0 comments on commit b43fbbd

Please sign in to comment.