-
Notifications
You must be signed in to change notification settings - Fork 7
/
suite_spec.rb
56 lines (49 loc) · 1.89 KB
/
suite_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# coding: utf-8
require_relative 'spec_helper'
require 'rdf/rdfxml'
describe RDF::RDFXML::Reader do
describe "w3c rdfcore tests" do
require_relative 'suite_helper'
%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|
specify "#{t.name}" do
t.logger = RDF::Spec.logger
t.logger.info t.inspect
t.logger.info "source:\n#{t.input}"
reader = RDF::RDFXML::Reader.new(t.input,
base_uri: t.base,
canonicalize: false,
validate: t.syntax?,
logger: t.logger)
repo = RDF::Repository.new
if reader.instance_variable_get(:@library) == :rexml
pending("no namespace attributes") if t.name == "unrecognised-xml-attributes-test002"
end
pending("XML-C14XL") if t.name == "xml-canon-test001"
if t.positive_test?
begin
repo << reader
rescue Exception => e
t.logger.debug e.e.backtrace.unshift("Backtrace:").join("\n")
expect(e.message).to produce("Not exception #{e.inspect}", t.logger)
end
else
expect {
repo << reader
}.to raise_error(RDF::ReaderError)
end
if t.evaluate? && t.positive_test?
output_repo = RDF::Repository.load(t.result, format: :ntriples, base_uri: t.base)
expect(repo).to be_equivalent_graph(output_repo, t)
elsif !t.evaluate?
expect(repo).to be_a(RDF::Enumerable)
end
end
end
end
end
end
end
end unless ENV['CI'] # Not for continuous integration