From fb0c5fd06184f33a03d8d4fb29a3aef8b1dafe78 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 8 Nov 2020 17:54:28 +0100 Subject: repo: expose all lamport clocks, move clocks in their own folder --- bug/operation_iterator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bug/operation_iterator_test.go') diff --git a/bug/operation_iterator_test.go b/bug/operation_iterator_test.go index 5d245185..e066ddd8 100644 --- a/bug/operation_iterator_test.go +++ b/bug/operation_iterator_test.go @@ -25,7 +25,7 @@ func ExampleOperationIterator() { } func TestOpIterator(t *testing.T) { - mockRepo := repository.NewMockRepoForTest() + mockRepo := repository.NewMockRepo() rene := identity.NewIdentity("René Descartes", "rene@descartes.fr") err := rene.Commit(mockRepo) -- cgit From 7163b2283b4542a4d4abfe9a71963f122322bde7 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 8 Nov 2020 19:15:06 +0100 Subject: bug: Id from first operation data, not git + remove root link --- bug/operation_iterator_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bug/operation_iterator_test.go') diff --git a/bug/operation_iterator_test.go b/bug/operation_iterator_test.go index e066ddd8..81d87a5f 100644 --- a/bug/operation_iterator_test.go +++ b/bug/operation_iterator_test.go @@ -25,10 +25,11 @@ func ExampleOperationIterator() { } func TestOpIterator(t *testing.T) { - mockRepo := repository.NewMockRepo() + repo := repository.NewMockRepo() - rene := identity.NewIdentity("René Descartes", "rene@descartes.fr") - err := rene.Commit(mockRepo) + rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr") + require.NoError(t, err) + err = rene.Commit(repo) require.NoError(t, err) unix := time.Now().Unix() @@ -51,14 +52,14 @@ func TestOpIterator(t *testing.T) { bug1.Append(addCommentOp) bug1.Append(setStatusOp) bug1.Append(labelChangeOp) - err = bug1.Commit(mockRepo) + err = bug1.Commit(repo) require.NoError(t, err) // second pack bug1.Append(genTitleOp()) bug1.Append(genTitleOp()) bug1.Append(genTitleOp()) - err = bug1.Commit(mockRepo) + err = bug1.Commit(repo) require.NoError(t, err) // staging -- cgit From 3f6ef50883492f77995a7e27872d0b5ae17b9d6a Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 14 Feb 2021 11:36:32 +0100 Subject: bug: migrate to the DAG entity structure! --- bug/operation_iterator_test.go | 79 ------------------------------------------ 1 file changed, 79 deletions(-) delete mode 100644 bug/operation_iterator_test.go (limited to 'bug/operation_iterator_test.go') diff --git a/bug/operation_iterator_test.go b/bug/operation_iterator_test.go deleted file mode 100644 index 81d87a5f..00000000 --- a/bug/operation_iterator_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package bug - -import ( - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/MichaelMure/git-bug/identity" - "github.com/MichaelMure/git-bug/repository" -) - -func ExampleOperationIterator() { - b := NewBug() - - // add operations - - it := NewOperationIterator(b) - - for it.Next() { - // do something with each operations - _ = it.Value() - } -} - -func TestOpIterator(t *testing.T) { - repo := repository.NewMockRepo() - - rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr") - require.NoError(t, err) - err = rene.Commit(repo) - require.NoError(t, err) - - unix := time.Now().Unix() - - createOp := NewCreateOp(rene, unix, "title", "message", nil) - addCommentOp := NewAddCommentOp(rene, unix, "message2", nil) - setStatusOp := NewSetStatusOp(rene, unix, ClosedStatus) - labelChangeOp := NewLabelChangeOperation(rene, unix, []Label{"added"}, []Label{"removed"}) - - var i int - genTitleOp := func() Operation { - i++ - return NewSetTitleOp(rene, unix, fmt.Sprintf("title%d", i), "") - } - - bug1 := NewBug() - - // first pack - bug1.Append(createOp) - bug1.Append(addCommentOp) - bug1.Append(setStatusOp) - bug1.Append(labelChangeOp) - err = bug1.Commit(repo) - require.NoError(t, err) - - // second pack - bug1.Append(genTitleOp()) - bug1.Append(genTitleOp()) - bug1.Append(genTitleOp()) - err = bug1.Commit(repo) - require.NoError(t, err) - - // staging - bug1.Append(genTitleOp()) - bug1.Append(genTitleOp()) - bug1.Append(genTitleOp()) - - it := NewOperationIterator(bug1) - - counter := 0 - for it.Next() { - _ = it.Value() - counter++ - } - - require.Equal(t, 10, counter) -} -- cgit