diff options
| author | Aidan Nulman <[email protected]> | 2014-02-24 03:05:44 -0500 |
|---|---|---|
| committer | Aidan Nulman <[email protected]> | 2014-02-24 03:05:44 -0500 |
| commit | 2656a72e823e16451480b7858213f6e3cb8bb2fd (patch) | |
| tree | e31656bc81965c4d18864d8305f2f6ff65fd627a /odb_test.go | |
| parent | decaf064f9ace275789657343d5123ee5290ea31 (diff) | |
| parent | c6d1bde37cc7f3bd213fc182fd9f60a7cd685419 (diff) | |
Merge branch 'master' into custom_odb
Conflicts:
git.go
reference.go
repository.go
submodule.go
Diffstat (limited to 'odb_test.go')
| -rw-r--r-- | odb_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/odb_test.go b/odb_test.go index 3c7624c..a4f8943 100644 --- a/odb_test.go +++ b/odb_test.go @@ -32,4 +32,31 @@ func TestOdbStream(t *testing.T) { if stream.Id.Cmp(expectedId) != 0 { t.Fatal("Wrong data written") } +} + +func TestOdbHash(t *testing.T) { + + repo := createTestRepo(t) + defer os.RemoveAll(repo.Workdir()) + _, _ = seedTestRepo(t, repo) + + odb, error := repo.Odb() + checkFatal(t, error) + + str := `tree 115fcae49287c82eb55bb275cbbd4556fbed72b7 +parent 66e1c476199ebcd3e304659992233132c5a52c6c +author John Doe <[email protected]> 1390682018 +0000 +committer John Doe <[email protected]> 1390682018 +0000 + +Initial commit.`; + + oid, error := odb.Hash([]byte(str), ObjectCommit) + checkFatal(t, error) + + coid, error := odb.Write([]byte(str), ObjectCommit) + checkFatal(t, error) + + if oid.Cmp(coid) != 0 { + t.Fatal("Hash and write Oids are different") + } }
\ No newline at end of file |
