Improve Transaction: deduplicate quads, allow adding/removing a quad in the same tx

This commit is contained in:
Quentin Machu 2015-10-06 15:21:33 -04:00
parent 45d96e14ec
commit 91fc9ee3de
2 changed files with 7 additions and 7 deletions

View file

@ -29,8 +29,8 @@ func TestTransaction(t *testing.T) {
// remove, add -> nothing
tx = NewTransaction()
tx.AddQuad(quad.Quad{Subject: "E", Predicate: "follows", Object: "G", Label: ""})
tx.RemoveQuad(quad.Quad{Subject: "E", Predicate: "follows", Object: "G", Label: ""})
tx.AddQuad(quad.Quad{Subject: "E", Predicate: "follows", Object: "G", Label: ""})
if len(tx.Deltas) != 0 {
t.Errorf("Expected [add, remove]->[], have %d delta(s)", len(tx.Deltas))
}