Skip to content

Commit

Permalink
feat: parallel tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 8, 2023
1 parent 685b874 commit 6959ccb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gobrew_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestNewGobrewHomeDirUsesUserHomeDir(t *testing.T) {
t.Parallel()
homeDir, err := os.UserHomeDir()

if err != nil {
Expand All @@ -24,6 +25,7 @@ func TestNewGobrewHomeDirUsesUserHomeDir(t *testing.T) {
}

func TestNewGobrewHomeDirDefaultsToHome(t *testing.T) {
t.Parallel()
var envName string

switch runtime.GOOS {
Expand All @@ -49,6 +51,7 @@ func TestNewGobrewHomeDirDefaultsToHome(t *testing.T) {
}

func TestNewGobrewHomeDirUsesGoBrewRoot(t *testing.T) {
t.Parallel()
oldEnvValue := os.Getenv("GOBREW_ROOT")
defer func() {
_ = os.Setenv("GOBREW_ROOT", oldEnvValue)
Expand All @@ -63,6 +66,7 @@ func TestNewGobrewHomeDirUsesGoBrewRoot(t *testing.T) {
}

func TestJudgeVersion(t *testing.T) {
t.Parallel()
tests := []struct {
version string
wantVersion string
Expand Down Expand Up @@ -106,6 +110,7 @@ func TestJudgeVersion(t *testing.T) {
for _, test := range tests {
test := test
t.Run(test.version, func(t *testing.T) {
t.Parallel()
gb := NewGoBrew()
version := gb.judgeVersion(test.version)
assert.Equal(t, test.wantVersion, version)
Expand All @@ -116,6 +121,7 @@ func TestJudgeVersion(t *testing.T) {
}

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

Expand All @@ -124,6 +130,7 @@ func TestListVersions(t *testing.T) {
}

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

Expand All @@ -134,6 +141,7 @@ func TestExistVersion(t *testing.T) {
}

func TestInstallAndExistVersion(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()
gb := NewGoBrewDirectory(tempDir)
gb.Install("1.19")
Expand All @@ -143,6 +151,7 @@ func TestInstallAndExistVersion(t *testing.T) {
}

func TestUnInstallThenNotExistVersion(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()
gb := NewGoBrewDirectory(tempDir)
gb.Uninstall("1.19")
Expand All @@ -152,6 +161,7 @@ func TestUnInstallThenNotExistVersion(t *testing.T) {
}

func TestUpgrade(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()

gb := NewGoBrewDirectory(tempDir)
Expand Down Expand Up @@ -202,6 +212,7 @@ func TestDoNotUpgradeLatestVersion(t *testing.T) {
}

func TestInteractive(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()

gb := NewGoBrewDirectory(tempDir)
Expand Down Expand Up @@ -233,6 +244,7 @@ func TestInteractive(t *testing.T) {
}

func TestPrune(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()
gb := NewGoBrewDirectory(tempDir)
gb.Install("1.20")
Expand All @@ -245,6 +257,7 @@ func TestPrune(t *testing.T) {
}

func TestGoBrew_CurrentVersion(t *testing.T) {
t.Parallel()
tempDir := t.TempDir()
gb := NewGoBrewDirectory(tempDir)
assert.Equal(t, true, gb.CurrentVersion() == "None")
Expand Down

0 comments on commit 6959ccb

Please sign in to comment.