Skip to content

Commit

Permalink
Merge pull request #112 from JunNishimura/#111
Browse files Browse the repository at this point in the history
fix test
  • Loading branch information
JunNishimura committed Jun 10, 2023
2 parents adb6bdb + 1d9d31b commit f5999e2
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 181 deletions.
23 changes: 16 additions & 7 deletions internal/store/index_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package store

import (
"encoding/hex"
"errors"
"os"
"path/filepath"
Expand All @@ -22,8 +23,10 @@ func TestNewEntry(t *testing.T) {
want *Entry
}
tests := []*test{

func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")
nameLength := uint16(len(path))

Expand Down Expand Up @@ -145,7 +148,8 @@ func TestUpdate(t *testing.T) {
}
tests := []*test{
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

return &test{
Expand All @@ -160,7 +164,8 @@ func TestUpdate(t *testing.T) {
}
}(),
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

return &test{
Expand Down Expand Up @@ -262,7 +267,8 @@ func TestGetEntry(t *testing.T) {
}
tests := []*test{
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

entry := NewEntry(hash, path)
Expand All @@ -282,7 +288,8 @@ func TestGetEntry(t *testing.T) {
}
}(),
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

return &test{
Expand Down Expand Up @@ -387,7 +394,8 @@ func TestDeleteEntry(t *testing.T) {
}
tests := []*test{
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

entry := NewEntry(hash, path)
Expand All @@ -405,7 +413,8 @@ func TestDeleteEntry(t *testing.T) {
}
}(),
func() *test {
hash := sha.SHA1([]byte("87f3c49bccf2597484ece08746d3ee5defaba335"))
hash, _ := hex.DecodeString("87f3c49bccf2597484ece08746d3ee5defaba335")
hash = sha.SHA1(hash)
path := []byte("cmd/main.go")

dummyEntry := NewEntry([]byte{}, []byte("not_exist.txt"))
Expand Down
Loading

0 comments on commit f5999e2

Please sign in to comment.