diff options
author | Michael Muré <batolettre@gmail.com> | 2020-11-08 17:54:28 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:15:41 +0100 |
commit | fb0c5fd06184f33a03d8d4fb29a3aef8b1dafe78 (patch) | |
tree | a0d87d04a991368840645591f11284b7ea27160c /repository/repo_testing.go | |
parent | 44d7587940f842a343a64d9107601591bdfb1027 (diff) | |
download | git-bug-fb0c5fd06184f33a03d8d4fb29a3aef8b1dafe78.tar.gz |
repo: expose all lamport clocks, move clocks in their own folder
Diffstat (limited to 'repository/repo_testing.go')
-rw-r--r-- | repository/repo_testing.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/repository/repo_testing.go b/repository/repo_testing.go index c0e1fa79..2c8705d6 100644 --- a/repository/repo_testing.go +++ b/repository/repo_testing.go @@ -191,13 +191,17 @@ func RepoDataTest(t *testing.T, repo RepoData) { // helper to test a RepoClock func RepoClockTest(t *testing.T, repo RepoClock) { + allClocks, err := repo.AllClocks() + require.NoError(t, err) + require.Len(t, allClocks, 0) + clock, err := repo.GetOrCreateClock("foo") require.NoError(t, err) require.Equal(t, lamport.Time(1), clock.Time()) time, err := clock.Increment() require.NoError(t, err) - require.Equal(t, lamport.Time(1), time) + require.Equal(t, lamport.Time(2), time) require.Equal(t, lamport.Time(2), clock.Time()) clock2, err := repo.GetOrCreateClock("foo") @@ -207,6 +211,13 @@ func RepoClockTest(t *testing.T, repo RepoClock) { clock3, err := repo.GetOrCreateClock("bar") require.NoError(t, err) require.Equal(t, lamport.Time(1), clock3.Time()) + + allClocks, err = repo.AllClocks() + require.NoError(t, err) + require.Equal(t, map[string]lamport.Clock{ + "foo": clock, + "bar": clock3, + }, allClocks) } func randomData() []byte { |