Created
October 17, 2010 12:22
-
-
Save artob/630798 to your computer and use it in GitHub Desktop.
DAWG test suite runner for SPARQL::Grammar::Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'spec_helper') | |
DAWG = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#') | |
MF = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#') | |
QT = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-query#') | |
RS = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/result-set#') | |
describe SPARQL::Grammar::Parser do | |
file = File.expand_path('./spec/dawg-test-suite/data-r2/manifest-syntax.ttl') | |
url = RDF::URI("file://#{file}") | |
data = RDF::Repository.load(file, :base_uri => url) | |
manifests = RDF::List.new(data.query([url, MF.include]).first_object, data) | |
manifests.each do |manifest| | |
data = RDF::Repository.load(manifest.to_s[('file://'.size)..-1], :base_uri => manifest) # FIXME | |
manifest_comment = data.query([manifest, RDF::RDFS.comment]).first_object | |
context "when parsing the DAWG #{manifest_comment.to_s.downcase}" do | |
entries = RDF::List.new(data.query([manifest, MF.entries]).first_object, data) | |
entries.each do |entry| | |
entry_type = data.query([entry, RDF.type]).first_object | |
entry_name = data.query([entry, MF.name]).first_object | |
entry_comment = data.query([entry, RDF::RDFS.comment]).first_object | |
entry_action = data.query([entry, MF.action]).first_object | |
entry_approval = data.query([entry, DAWG.approval]).first_object | |
entry_query = File.read(entry_action.to_s[('file://'.size)..-1]) | |
case entry_type | |
when MF.PositiveSyntaxTest | |
context "the #{entry.fragment} test" do | |
it "should accept the input #{entry_query.inspect}" do | |
# TODO | |
end | |
end | |
when MF.NegativeSyntaxTest | |
context "the #{entry.fragment} test" do | |
should = entry_comment ? | |
"should reject the input #{entry_query.inspect} (#{entry_comment})" : | |
"should reject the input #{entry_query.inspect}" | |
it should do | |
# TODO | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment