|
11 | 11 | skip "Immutable resource" unless mutable.mutable? |
12 | 12 | @statements = RDF::Spec.triples |
13 | 13 | @supports_named_graphs = mutable.respond_to?(:supports?) && mutable.supports?(:graph_name) |
| 14 | + @supports_literal_equality = mutable.respond_to?(:supports?) && mutable.supports?(:literal_equality) |
14 | 15 | end |
15 | 16 |
|
16 | 17 | let(:resource) { RDF::URI('http://rubygems.org/gems/rdf') } |
|
189 | 190 | subject.delete(s3) |
190 | 191 | expect(subject.count).to eq count - (@supports_named_graphs ? 3 : 1) |
191 | 192 | end |
192 | | - |
| 193 | + |
| 194 | + it 'does not delete literal with different language' do |
| 195 | + if subject.mutable? |
| 196 | + en = RDF::Literal('abc', language: 'en') |
| 197 | + fi = RDF::Literal('abc', language: 'fi') |
| 198 | + |
| 199 | + subject.insert([RDF::URI('s'), RDF::URI('p'), en]) |
| 200 | + expect { subject.delete([RDF::URI('s'), RDF::URI('p'), fi]) } |
| 201 | + .not_to change { subject.count } |
| 202 | + end |
| 203 | + end |
| 204 | + |
| 205 | + it 'does not delete literal with different datatype' do |
| 206 | + if subject.mutable? && @supports_literal_equality |
| 207 | + float = RDF::Literal::Float.new(1.0) |
| 208 | + double = RDF::Literal::Double.new(1.0) |
| 209 | + |
| 210 | + subject.insert([RDF::URI('s'), RDF::URI('p'), float]) |
| 211 | + |
| 212 | + expect { subject.delete([RDF::URI('s'), RDF::URI('p'), double]) } |
| 213 | + .not_to change { subject.count } |
| 214 | + end |
| 215 | + end |
| 216 | + |
193 | 217 | describe '#delete_insert' do |
194 | 218 | let(:statement) do |
195 | 219 | RDF::Statement.new(resource, |
|
0 commit comments