aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-05-11 11:17:04 +1000
committerArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-05-11 11:17:04 +1000
commitb8dd39abcc9dd35808ec625a90a68c0ace4973e4 (patch)
tree513a5972fca375657cbf904c4153987e506f8cf0 /repository_test.go
parent1dbd729a387edb61c89f088cd68040085e6c81bb (diff)
downloadgo-git-b8dd39abcc9dd35808ec625a90a68c0ace4973e4.tar.gz
git: Testing, Fix tests not cleaning temp folders
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/repository_test.go b/repository_test.go
index 0080a83..45af396 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -60,17 +59,18 @@ func (s *RepositorySuite) TestInitNonStandardDotGit(c *C) {
fs := osfs.New(dir)
dot, _ := fs.Chroot("storage")
- storage := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
+ st := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
wt, _ := fs.Chroot("worktree")
- r, err := Init(storage, wt)
+ r, err := Init(st, wt)
c.Assert(err, IsNil)
c.Assert(r, NotNil)
f, err := fs.Open(fs.Join("worktree", ".git"))
c.Assert(err, IsNil)
+ defer func() { _ = f.Close() }()
- all, err := ioutil.ReadAll(f)
+ all, err := io.ReadAll(f)
c.Assert(err, IsNil)
c.Assert(string(all), Equals, fmt.Sprintf("gitdir: %s\n", filepath.Join("..", "storage")))
@@ -85,9 +85,9 @@ func (s *RepositorySuite) TestInitStandardDotGit(c *C) {
fs := osfs.New(dir)
dot, _ := fs.Chroot(".git")
- storage := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
+ st := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
- r, err := Init(storage, fs)
+ r, err := Init(st, fs)
c.Assert(err, IsNil)
c.Assert(r, NotNil)
@@ -3009,14 +3009,14 @@ func BenchmarkObjects(b *testing.B) {
b.Run(f.URL, func(b *testing.B) {
fs := f.DotGit()
- storer := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
+ st := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
worktree, err := fs.Chroot(filepath.Dir(fs.Root()))
if err != nil {
b.Fatal(err)
}
- repo, err := Open(storer, worktree)
+ repo, err := Open(st, worktree)
if err != nil {
b.Fatal(err)
}
@@ -3046,7 +3046,7 @@ func BenchmarkObjects(b *testing.B) {
func BenchmarkPlainClone(b *testing.B) {
for i := 0; i < b.N; i++ {
- t, err := ioutil.TempDir("", "")
+ t, err := os.MkdirTemp("", "")
if err != nil {
b.Fatal(err)
}