Skip to content

Commit d3f01ef

Browse files
committed
Validate all suite tests and enable validation when parsing.
Now passes all tests.
1 parent 6f340bf commit d3f01ef

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

bin/ldpatch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ opts = GetoptLong.new(
4444
["--progress", GetoptLong::NO_ARGUMENT],
4545
["--sse", GetoptLong::NO_ARGUMENT],
4646
["--to-sse", GetoptLong::NO_ARGUMENT],
47+
["--validate", GetoptLong::NO_ARGUMENT],
4748
["--verbose", GetoptLong::NO_ARGUMENT],
4849
["--help", "-?", GetoptLong::NO_ARGUMENT]
4950
)
@@ -62,6 +63,7 @@ opts.each do |opt, arg|
6263
when '--progress' then options[:debug] ||= 2
6364
when '--sse' then options[:sse] = true
6465
when '--to-sse' then options[:to_sse] = true
66+
when '--validate' then options[:validate] = true
6567
when '--verbose' then options[:verbose] = true
6668
when "--help"
6769
puts "Usage: #{$0} [options] file-or-uri ..."

lib/ld/patch/parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Parser
6060
# Note that a Turtle Decimal may begin with a '.', so tack on a leading
6161
# zero if necessary
6262
value = token.value
63-
#value = "0#{token.value}" if token.value[0,1] == "."
63+
value = "0#{token.value}" if token.value[0,1] == "."
6464
input[:literal] = literal(value, datatype: RDF::XSD.decimal)
6565
end
6666
terminal(:INTEGER, INTEGER) do |prod, token, input|
@@ -567,7 +567,7 @@ def iri(value)
567567
RDF::URI(value)
568568
end
569569

570-
#iri.validate! if validate? && iri.respond_to?(:validate)
570+
iri.validate! if validate? && iri.respond_to?(:validate)
571571
#iri = RDF::URI.intern(iri) if intern?
572572
iri
573573
end

spec/suite_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Entry < JSON::LD::Resource
114114
attr_accessor :debug
115115

116116
def base
117-
action.is_a?(Hash) && action.fetch("base", action["data"])
117+
action.is_a?(Hash) ? action.fetch("base", action["data"]) : action
118118
end
119119

120120
# Alias data and query

spec/suite_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
begin
2626
operator = LD::Patch.parse(t.input,
2727
base_uri: t.base,
28+
validate: true,
2829
debug: t.debug
2930
)
3031
if t.positive_test?

0 commit comments

Comments
 (0)