Skip to content

Commit

Permalink
fix: issue with no tests were run
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 7, 2023
1 parent 814b7e7 commit 4a397d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions gobrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func (gb *GoBrew) mkDirs(version string) {
func (gb *GoBrew) getVersionDir(version string) string {
return filepath.Join(gb.versionsDir, version)
}

func (gb *GoBrew) downloadAndExtract(version string) {
tarName := "go" + version + "." + gb.getArch()

Expand Down
13 changes: 13 additions & 0 deletions gobrew_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestNewGobrewHomeDirUsesUserHomeDir(t *testing.T) {
gobrew := NewGoBrew()

assert.Equal(t, homeDir, gobrew.homeDir)
t.Log("test finished")
}

func TestNewGobrewHomeDirDefaultsToHome(t *testing.T) {
Expand All @@ -44,6 +45,7 @@ func TestNewGobrewHomeDirDefaultsToHome(t *testing.T) {
gobrew := NewGoBrew()

assert.Equal(t, os.Getenv("HOME"), gobrew.homeDir)
t.Log("test finished")
}

func TestNewGobrewHomeDirUsesGoBrewRoot(t *testing.T) {
Expand All @@ -57,6 +59,7 @@ func TestNewGobrewHomeDirUsesGoBrewRoot(t *testing.T) {
gobrew := NewGoBrew()

assert.Equal(t, "some_fancy_value", gobrew.homeDir)
t.Log("test finished")
}

func TestJudgeVersion(t *testing.T) {
Expand Down Expand Up @@ -109,13 +112,15 @@ func TestJudgeVersion(t *testing.T) {

})
}
t.Log("test finished")
}

func TestListVersions(t *testing.T) {
tempDir := t.TempDir()
gb := NewGoBrewDirectory(tempDir)

gb.ListVersions()
t.Log("test finished")
}

func TestExistVersion(t *testing.T) {
Expand All @@ -125,6 +130,7 @@ func TestExistVersion(t *testing.T) {
exists := gb.existsVersion("1.19")

assert.Equal(t, false, exists)
t.Log("test finished")
}

func TestInstallAndExistVersion(t *testing.T) {
Expand All @@ -133,6 +139,7 @@ func TestInstallAndExistVersion(t *testing.T) {
gb.Install("1.19")
exists := gb.existsVersion("1.19")
assert.Equal(t, true, exists)
t.Log("test finished")
}

func TestUnInstallThenNotExistVersion(t *testing.T) {
Expand All @@ -141,6 +148,7 @@ func TestUnInstallThenNotExistVersion(t *testing.T) {
gb.Uninstall("1.19")
exists := gb.existsVersion("1.19")
assert.Equal(t, false, exists)
t.Log("test finished")
}

func TestUpgrade(t *testing.T) {
Expand All @@ -167,6 +175,7 @@ func TestUpgrade(t *testing.T) {
if _, err := os.Stat(binaryFile); err != nil {
t.Errorf("updated executable does not exist")
}
t.Log("test finished")
}

func TestDoNotUpgradeLatestVersion(t *testing.T) {
Expand Down Expand Up @@ -195,6 +204,7 @@ func TestDoNotUpgradeLatestVersion(t *testing.T) {
if _, err := os.Stat(binaryFile); err == nil {
t.Errorf("unexpected upgrade of latest version")
}
t.Log("test finished")
}

func TestInteractive(t *testing.T) {
Expand Down Expand Up @@ -226,6 +236,7 @@ func TestInteractive(t *testing.T) {
currentVersion = gb.CurrentVersion()
currentVersion = strings.Replace(currentVersion, "private", "", -1)
assert.Equal(t, currentVersion, latestVersion)
t.Log("test finished")
}

func TestPrune(t *testing.T) {
Expand All @@ -237,6 +248,7 @@ func TestPrune(t *testing.T) {
gb.Prune()
assert.Equal(t, false, gb.existsVersion("1.20"))
assert.Equal(t, true, gb.existsVersion("1.19"))
t.Log("test finished")
}

func TestGoBrew_CurrentVersion(t *testing.T) {
Expand All @@ -246,4 +258,5 @@ func TestGoBrew_CurrentVersion(t *testing.T) {
gb.Install("1.19")
gb.Use("1.19")
assert.Equal(t, true, gb.CurrentVersion() == "1.19")
t.Log("test finished")
}

0 comments on commit 4a397d3

Please sign in to comment.