Skip to content

Commit

Permalink
Adjust test suite locations and address local caching issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jul 18, 2023
1 parent 32e1291 commit 5bdd183
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions script/tc
Expand Up @@ -196,9 +196,9 @@ manifests = if options[:rdfstar]
|man| "https://w3c.github.io/rdf-star/tests/#{man}/"
end
elsif options[:nquads]
[Fixtures::SuiteTest::NQBASE]
[Fixtures::SuiteTest::BASE + "rdf11/rdf-n-quads/"]
else
[Fixtures::SuiteTest::BASE]
[Fixtures::SuiteTest::BASE + "rdf11/rdf-trig/"]
end.map {|m| "#{m}manifest.ttl"}

earl_preamble(**options) if options[:earl]
Expand Down
38 changes: 20 additions & 18 deletions spec/nquads_spec.rb
Expand Up @@ -6,29 +6,31 @@
describe "w3c N-Quads tests" do
require 'suite_helper'

Fixtures::SuiteTest::Manifest.open("#{Fixtures::SuiteTest::NQBASE}manifest.ttl") do |m|
describe m.comment do
m.entries.each do |t|
specify "#{t.name}: #{t.comment}" do
t.logger = RDF::Spec.logger
t.logger.info t.inspect
t.logger.info "source:\n#{t.input}"
%w(rdf11/rdf-n-quads/manifest.ttl).each do |man|
Fixtures::SuiteTest::Manifest.open(Fixtures::SuiteTest::BASE + man) do |m|
describe m.comment do
m.entries.each do |t|
specify "#{t.name}: #{t.comment}" do
t.logger = RDF::Spec.logger
t.logger.info t.inspect
t.logger.info "source:\n#{t.input}"

reader = RDF::NQuads::Reader.new(t.input, logger: t.logger, validate: true)
reader = RDF::NQuads::Reader.new(t.input, logger: t.logger, validate: true)

repo = RDF::Repository.new
repo = RDF::Repository.new

if t.positive_test?
begin
repo << reader
rescue Exception => e
expect(e.message).to produce("Not exception #{e.inspect}", t.logger)
if t.positive_test?
begin
repo << reader
rescue Exception => e
expect(e.message).to produce("Not exception #{e.inspect}", t.logger)
end
else
expect {repo << reader}.to raise_error(RDF::ReaderError)
end
else
expect {repo << reader}.to raise_error(RDF::ReaderError)
end

expect(repo).to be_a(RDF::Enumerable)
expect(repo).to be_a(RDF::Enumerable)
end
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions spec/suite_helper.rb
Expand Up @@ -140,8 +140,7 @@ def self.open_file(filename_or_url, **options, &block)

module Fixtures
module SuiteTest
BASE = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-trig/"
NQBASE = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-n-quads/"
BASE = "https://w3c.github.io/rdf-tests/rdf/"
FRAME = JSON.parse(%q({
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
Expand Down Expand Up @@ -187,7 +186,7 @@ class Entry < JSON::LD::Resource
attr_accessor :logger

def base
BASE + action.split('/').last
RDF::URI(action)
end

# Alias data and query
Expand Down
2 changes: 1 addition & 1 deletion spec/suite_spec.rb
Expand Up @@ -6,7 +6,7 @@
require 'suite_helper'

# TriG/manifest.ttl
%w(manifest.ttl).each do |man|
%w(rdf11/rdf-trig/manifest.ttl).each do |man|
Fixtures::SuiteTest::Manifest.open(Fixtures::SuiteTest::BASE + man) do |m|
describe m.comment do
m.entries.each do |t|
Expand Down
2 changes: 1 addition & 1 deletion spec/writer_spec.rb
Expand Up @@ -309,7 +309,7 @@
describe "w3c trig tests" do
require 'suite_helper'

%w(manifest.ttl).each do |man|
%w(rdf11/rdf-trig/manifest.ttl).each do |man|
Fixtures::SuiteTest::Manifest.open(Fixtures::SuiteTest::BASE + man) do |m|
describe m.comment do
m.entries.each do |t|
Expand Down

0 comments on commit 5bdd183

Please sign in to comment.