-
Notifications
You must be signed in to change notification settings - Fork 71
Add Conflicts.ToSet() #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,34 @@ conflicts with "Bob": | |
| t.Errorf("Got %v, wanted %v", got.Error(), wanted) | ||
| } | ||
| } | ||
|
|
||
| func TestToSet(t *testing.T) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding the test, now that you've done that, I realize that it's aggregating the conflicts one has with all users. You need to document the method above to explain that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, done |
||
| conflicts := merge.ConflictsFromManagers(fieldpath.ManagedFields{ | ||
| "Bob": fieldpath.NewVersionedSet( | ||
| _NS( | ||
| _P("key"), | ||
| _P("list", _KBF("key", "a", "id", 2), "id"), | ||
| ), | ||
| "v1", | ||
| false, | ||
| ), | ||
| "Alice": fieldpath.NewVersionedSet( | ||
| _NS( | ||
| _P("value"), | ||
| _P("list", _KBF("key", "a", "id", 2), "key"), | ||
| ), | ||
| "v1", | ||
| false, | ||
| ), | ||
| }) | ||
| expected := fieldpath.NewSet( | ||
| _P("key"), | ||
| _P("value"), | ||
| _P("list", _KBF("key", "a", "id", 2), "id"), | ||
| _P("list", _KBF("key", "a", "id", 2), "key"), | ||
| ) | ||
| actual := conflicts.ToSet() | ||
| if !expected.Equals(actual) { | ||
| t.Fatalf("expected\n%v\n, but got\n%v\n", expected, actual) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, maybe write a quick test?