diff --git a/script/tc b/script/tc index 067c9d0..ed28deb 100755 --- a/script/tc +++ b/script/tc @@ -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}" @@ -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 @@ -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 %{ @@ -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 diff --git a/spec/.gitignore b/spec/.gitignore index a4cc2ca..1dbd86d 100644 --- a/spec/.gitignore +++ b/spec/.gitignore @@ -1 +1,2 @@ /uri-cache/ +/w3c-rdf-tests diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb index 6fda920..ef76ac7 100644 --- a/spec/suite_helper.rb +++ b/spec/suite_helper.rb @@ -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 @@ -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#", @@ -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 diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index 7cb5803..8993e41 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -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| diff --git a/spec/writer_spec.rb b/spec/writer_spec.rb index 1d1b9dd..95ab7ac 100644 --- a/spec/writer_spec.rb +++ b/spec/writer_spec.rb @@ -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|