Skip to content

Commit 7d87245

Browse files
committed
Allow Literal equality to take a different string for checking humanize.
1 parent f6fdffa commit 7d87245

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/rdf/spec/literal.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
shared_examples 'RDF::Literal' do |value, datatype_uri|
99
include_examples 'RDF::Literal with datatype and grammar', value, datatype_uri
10-
include_examples 'RDF::Literal equality', value
10+
include_examples 'RDF::Literal equality', value, value
1111
include_examples 'RDF::Literal lexical values', value
1212
end
1313

@@ -75,7 +75,8 @@
7575
end
7676

7777
shared_examples 'RDF::Literal canonicalization' do |datatype, pairs|
78-
pairs.each do |value, str|
78+
pairs.each do |value, str, human = nil|
79+
human ||= value
7980
klass = RDF::Literal.datatyped_class(datatype.to_s)
8081

8182
it "does not normalize '#{value}' by default" do
@@ -85,18 +86,18 @@
8586
.to eq value
8687
end
8788

88-
it "normalizes double '#{value}' to '#{str}'" do
89+
it "normalizes '#{value}' to '#{str}'" do
8990
expect(RDF::Literal.new(value,
9091
datatype: datatype,
9192
canonicalize: true).to_s)
9293
.to eq str
9394
end
9495

95-
it "humanizes double '#{value}' to '#{str}'" do
96+
it "humanizes '#{value}' to '#{str}'" do
9697
expect(RDF::Literal.new(value,
9798
datatype: datatype,
9899
canonicalize: false).humanize)
99-
.to eq value
100+
.to eq human
100101
end
101102

102103
it "instantiates '#{value}' as #{klass}" do

0 commit comments

Comments
 (0)