aboutsummaryrefslogtreecommitdiff
path: root/object/commit/roundtrip_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'object/commit/roundtrip_test.go')
-rw-r--r--object/commit/roundtrip_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/object/commit/roundtrip_test.go b/object/commit/roundtrip_test.go
index 8169e75f..1cfcaaac 100644
--- a/object/commit/roundtrip_test.go
+++ b/object/commit/roundtrip_test.go
@@ -25,13 +25,13 @@ func TestRoundTrip(t *testing.T) {
t.Fatalf("NewRepo: %v", err)
}
- blobID, err := repo.HashObject(t, typ.TypeBlob, strings.NewReader("roundtrip\n"))
+ blobID, err := repo.HashObject(t, typ.Blob, strings.NewReader("roundtrip\n"))
if err != nil {
t.Fatalf("HashObject(blob): %v", err)
}
treeID, err := repo.MkTree(t, []testgit.TreeEntry{
- {Mode: "100644", Type: typ.TypeBlob, OID: blobID, Name: "roundtrip.txt"},
+ {Mode: "100644", Type: typ.Blob, OID: blobID, Name: "roundtrip.txt"},
})
if err != nil {
t.Fatalf("MkTree: %v", err)
@@ -87,10 +87,10 @@ func TestRoundTrip(t *testing.T) {
OffsetMinutes: 330,
},
Message: []byte("roundtrip subject\n\nroundtrip body\n\n"),
- ChangeID: "zyxwvutsrqponmlk",
+ ChangeID: []byte("zyxwvutsrqponmlk"),
ExtraHeaders: []commit.ExtraHeader{
- {Key: "encoding", Value: []byte("UTF-8")},
- {Key: "x-test-header", Value: []byte("value")},
+ {Key: []byte("encoding"), Value: []byte("UTF-8")},
+ {Key: []byte("x-test-header"), Value: []byte("value")},
},
}
@@ -99,7 +99,7 @@ func TestRoundTrip(t *testing.T) {
t.Fatalf("AppendWithoutHeader: %v", err)
}
- roundTripID, err := repo.HashObject(t, typ.TypeCommit, bytes.NewReader(rawBody))
+ roundTripID, err := repo.HashObject(t, typ.Commit, bytes.NewReader(rawBody))
if err != nil {
t.Fatalf("HashObject(commit): %v", err)
}
@@ -112,7 +112,7 @@ func TestRoundTrip(t *testing.T) {
t.Fatalf("Fsck: %v", err)
}
- gitBody, err := repo.CatFile(t, typ.TypeCommit, roundTripID)
+ gitBody, err := repo.CatFile(t, typ.Commit, roundTripID)
if err != nil {
t.Fatalf("CatFile: %v", err)
}
@@ -145,7 +145,7 @@ func assertCommitEqual(t *testing.T, got *commit.Commit, want *commit.Commit) {
t.Fatalf("message = %q, want %q", got.Message, want.Message)
}
- if got.ChangeID != want.ChangeID {
+ if !bytes.Equal(got.ChangeID, want.ChangeID) {
t.Fatalf("change id = %q, want %q", got.ChangeID, want.ChangeID)
}
@@ -155,7 +155,7 @@ func assertCommitEqual(t *testing.T, got *commit.Commit, want *commit.Commit) {
for i, wantHeader := range want.ExtraHeaders {
gotHeader := got.ExtraHeaders[i]
- if gotHeader.Key != wantHeader.Key {
+ if !bytes.Equal(gotHeader.Key, wantHeader.Key) {
t.Fatalf("extra header[%d] key = %q, want %q", i, gotHeader.Key, wantHeader.Key)
}