aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operation_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-08-07 15:31:38 +0200
committerMichael Muré <batolettre@gmail.com>2019-08-08 19:02:46 +0200
commit2e1a5e246ee3589c2f664a62ebd06be7dc69c229 (patch)
tree03e69d6991fb4b9f9a159ba2d7b74b5f36d5069d /bug/operation_test.go
parent2c3034a0abe13eb6b07d8dd13041e7be4adc6f93 (diff)
downloadgit-bug-2e1a5e246ee3589c2f664a62ebd06be7dc69c229.tar.gz
bug: compute op's ID based on the serialized data on disk
Diffstat (limited to 'bug/operation_test.go')
-rw-r--r--bug/operation_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/bug/operation_test.go b/bug/operation_test.go
index 0ddb61c2..c8dc246e 100644
--- a/bug/operation_test.go
+++ b/bug/operation_test.go
@@ -79,7 +79,7 @@ func TestMetadata(t *testing.T) {
require.Equal(t, val, "value")
}
-func TestHash(t *testing.T) {
+func TestID(t *testing.T) {
repo := repository.CreateTestRepo(false)
defer repository.CleanupTestRepos(t, repo)
@@ -94,27 +94,27 @@ func TestHash(t *testing.T) {
b, op, err := Create(rene, time.Now().Unix(), "title", "message")
require.Nil(t, err)
- h1, err := op.Hash()
- require.Nil(t, err)
+ id1 := op.ID()
+ require.True(t, IDIsValid(id1))
err = b.Commit(repo)
require.Nil(t, err)
op2 := b.FirstOp()
- h2, err := op2.Hash()
- require.Nil(t, err)
+ id2 := op2.ID()
+ require.True(t, IDIsValid(id2))
- require.Equal(t, h1, h2)
+ require.Equal(t, id1, id2)
b2, err := ReadLocalBug(repo, b.id)
require.Nil(t, err)
op3 := b2.FirstOp()
- h3, err := op3.Hash()
- require.Nil(t, err)
+ id3 := op3.ID()
+ require.True(t, IDIsValid(id3))
- require.Equal(t, h1, h3)
+ require.Equal(t, id1, id3)
}
}