core: RDF.Data.deleting a Description with a different subject does nothing
This commit is contained in:
parent
81ffadbc53
commit
e666d9d143
2 changed files with 9 additions and 0 deletions
|
@ -505,6 +505,10 @@ end
|
|||
defimpl RDF.Data, for: RDF.Description do
|
||||
def add(description, statements), do: RDF.Description.add(description, statements)
|
||||
def put(description, statements), do: RDF.Description.put(description, statements)
|
||||
def delete(%RDF.Description{subject: subject} = description,
|
||||
%RDF.Description{subject: other_subject})
|
||||
when subject != other_subject,
|
||||
do: description
|
||||
def delete(description, statements), do: RDF.Description.delete(description, statements)
|
||||
def pop(description), do: RDF.Description.pop(description)
|
||||
|
||||
|
|
|
@ -387,6 +387,11 @@ defmodule RDF.DescriptionTest do
|
|||
assert RDF.Data.delete(description, {EX.Other, EX.p1, EX.O2}) == description
|
||||
end
|
||||
|
||||
test "deleting a Description with a different subject does nothing", %{description: description} do
|
||||
assert RDF.Data.delete(description,
|
||||
%Description{description | subject: EX.Other}) == description
|
||||
end
|
||||
|
||||
test "pop", %{description: description} do
|
||||
assert RDF.Data.pop(description) == Description.pop(description)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue