Skip to content

Commit

Permalink
Update for new test suite locations.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jul 18, 2023
1 parent 8c579c6 commit a48659d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
26 changes: 17 additions & 9 deletions script/tc
Expand Up @@ -31,7 +31,7 @@ def earl_preamble(options)
end

def run_tc(tc, **options)
STDERR.write "run #{tc.name}"
STDERR.write "run #{tc.name} "

if options[:verbose]
puts "\nTestCase: #{tc.inspect}"
Expand All @@ -41,9 +41,13 @@ def run_tc(tc, **options)

begin
puts "open #{tc.action}" if options[:verbose]
options = {base_uri: tc.base}.merge(options)
options = {
base_uri: tc.base,
validate: tc.syntax?,
logger: tc.logger
}.merge(options)

reader = RDF::Reader.for(tc.action).new(tc.input, base_uri: tc.base, validate: tc.syntax?, logger: options[:logger])
reader = RDF::Reader.for(tc.action).new(tc.input, **options)

graph = RDF::Repository.new
result = nil
Expand Down Expand Up @@ -84,7 +88,7 @@ def run_tc(tc, **options)
end
end

options[:output].puts("\nOutput:\n" + graph.dump(:ntriples, validate: false)) unless options[:quiet]
options[:output].puts("\nOutput:\n" + graph.dump(:ntriples, validate: false)) if options[:verbose]

if options[:earl]
options[:output].puts %{
Expand Down Expand Up @@ -147,16 +151,20 @@ opts.each do |opt, arg|
end
end

manifest = Fixtures::SuiteTest::BASE + "manifest.ttl"
manifests = [Fixtures::SuiteTest::BASE + "rdf11/rdf-xml/"].map {|m| "#{m}manifest.ttl"}

earl_preamble(options) if options[:earl]

result_count = {}

Fixtures::SuiteTest::Manifest.open(manifest) do |m|
m.entries.each do |tc|
next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
run_tc(tc, **options.merge(result_count: result_count))
begin
manifests.each do |manifest|
Fixtures::SuiteTest::Manifest.open(manifest) do |m|
m.entries.each do |tc|
next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
run_tc(tc, result_count: result_count, **options)
end
end
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/.gitignore
@@ -1 +1,2 @@
/uri-cache/
/w3c-rdf-tests
8 changes: 4 additions & 4 deletions spec/suite_helper.rb
Expand Up @@ -6,8 +6,8 @@
# For now, override RDF::Utils::File.open_file to look for the file locally before attempting to retrieve it
module RDF::Util
module File
REMOTE_PATH = "http://www.w3.org/2013/RDFXMLTests/"
LOCAL_PATH = ::File.expand_path("../w3c-rdf/rdf-xml", __FILE__) + '/'
REMOTE_PATH = "https://w3c.github.io/rdf-tests/rdf/"
LOCAL_PATH = ::File.expand_path("../w3c-rdf-tests/rdf/", __FILE__) + '/'

class << self
alias_method :original_open_file, :open_file
Expand Down Expand Up @@ -72,7 +72,7 @@ def self.open_file(filename_or_url, **options, &block)

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

def base
"http://www.w3.org/2013/RDFXMLTests/" + action.split('/')[-2,2].join("/")
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 @@
describe "w3c rdfcore tests" do
require_relative 'suite_helper'

%w(manifest.ttl).each do |man|
%w(rdf11/rdf-xml/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 @@ -684,7 +684,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
# W3C RDF/XML Test suite from https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-xml/tests/
describe "w3c RDF/XML tests" do
require 'suite_helper'
%w(manifest.ttl).each do |man|
%w(rdf11/rdf-xml/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 a48659d

Please sign in to comment.