aboutsummaryrefslogtreecommitdiffstats
path: root/config/config_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:40:08 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:40:08 +0200
commit01df7536992af375a54bbedf45369a475953e372 (patch)
tree8435050f4388f15b3a85d135a3f7d11b1ff61540 /config/config_test.go
parent67af9d7223b0cc643025d958c592291f7475ac75 (diff)
downloadgo-git-01df7536992af375a54bbedf45369a475953e372.tar.gz
*: use go-billy instead of os calls
Diffstat (limited to 'config/config_test.go')
-rw-r--r--config/config_test.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/config/config_test.go b/config/config_test.go
index b4a9ac3..6f0242d 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -1,11 +1,12 @@
package config
import (
- "io/ioutil"
"os"
"path/filepath"
"strings"
+ "github.com/go-git/go-billy/v5/osfs"
+ "github.com/go-git/go-billy/v5/util"
"github.com/go-git/go-git/v5/plumbing"
. "gopkg.in/check.v1"
)
@@ -154,7 +155,7 @@ func (s *ConfigSuite) TestMarshal(c *C) {
}
cfg.URLs["ssh://git@github.com/"] = &URL{
- Name: "ssh://git@github.com/",
+ Name: "ssh://git@github.com/",
InsteadOf: "https://github.com/",
}
@@ -204,23 +205,16 @@ func (s *ConfigSuite) TestUnmarshalMarshal(c *C) {
c.Assert(string(output), DeepEquals, string(input))
}
-func (s *ConfigSuite) TestLoadConfig(c *C) {
- cfg, err := LoadConfig(GlobalScope)
- c.Assert(cfg.User.Email, Not(Equals), "")
- c.Assert(err, IsNil)
-
-}
-
func (s *ConfigSuite) TestLoadConfigXDG(c *C) {
cfg := NewConfig()
cfg.User.Name = "foo"
cfg.User.Email = "foo@foo.com"
- tmp, err := ioutil.TempDir("", "test-commit-options")
+ tmp, err := util.TempDir(osfs.Default, "", "test-commit-options")
c.Assert(err, IsNil)
- defer os.RemoveAll(tmp)
+ defer util.RemoveAll(osfs.Default, tmp)
- err = os.Mkdir(filepath.Join(tmp, "git"), 0777)
+ err = osfs.Default.MkdirAll(filepath.Join(tmp, "git"), 0777)
c.Assert(err, IsNil)
os.Setenv("XDG_CONFIG_HOME", tmp)
@@ -232,7 +226,7 @@ func (s *ConfigSuite) TestLoadConfigXDG(c *C) {
c.Assert(err, IsNil)
cfgFile := filepath.Join(tmp, "git/config")
- err = ioutil.WriteFile(cfgFile, content, 0777)
+ err = util.WriteFile(osfs.Default, cfgFile, content, 0777)
c.Assert(err, IsNil)
cfg, err = LoadConfig(GlobalScope)