Skip to content

Commit

Permalink
all: run integration tests against Bash 5.0
Browse files Browse the repository at this point in the history
Now that 5.0 is released, we should run our tests against that version
instead of 4.4.

Some tests have broken on 5.0, which we'll fix in follow-up commits.

Updates mvdan#346.
  • Loading branch information
mvdan committed Jan 18, 2019
1 parent 7f14f56 commit 8fb18ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ let i=(2 + 3)
}
}

var hasBash44 bool
var hasBash50 bool

func TestMain(m *testing.M) {
os.Setenv("LANGUAGE", "en_US.UTF8")
os.Setenv("LC_ALL", "en_US.UTF8")
os.Unsetenv("CDPATH")
hasBash44 = checkBash()
hasBash50 = checkBash()
os.Setenv("INTERP_GLOBAL", "value")
os.Setenv("MULTILINE_INTERP_GLOBAL", "\nwith\nnewlines\n\n")

Expand All @@ -83,7 +83,7 @@ func checkBash() bool {
if err != nil {
return false
}
return strings.HasPrefix(string(out), "4.4")
return strings.HasPrefix(string(out), "5.0")
}

// concBuffer wraps a bytes.Buffer in a mutex so that concurrent writes
Expand Down Expand Up @@ -2375,8 +2375,8 @@ func TestFileConfirm(t *testing.T) {
if testing.Short() {
t.Skip("calling bash is slow")
}
if !hasBash44 {
t.Skip("bash 4.4 required to run")
if !hasBash50 {
t.Skip("bash 5.0 required to run")
}
if runtime.GOOS == "windows" {
// For example, it seems to treat environment variables as
Expand Down
12 changes: 6 additions & 6 deletions syntax/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ func TestParseMirBSDKorn(t *testing.T) {
}

var (
hasBash44 bool
hasBash50 bool
hasDash059 bool
hasMksh56 bool
)

func TestMain(m *testing.M) {
os.Setenv("LANGUAGE", "en_US.UTF8")
os.Setenv("LC_ALL", "en_US.UTF8")
hasBash44 = cmdContains("version 4.4", "bash", "--version")
hasBash50 = cmdContains("version 5.0", "bash", "--version")
// dash provides no way to check its version, so we have to
// check if it's new enough as to not have the bug that breaks
// our integration tests. Blergh.
Expand Down Expand Up @@ -151,8 +151,8 @@ func TestParseBashConfirm(t *testing.T) {
if testing.Short() {
t.Skip("calling bash is slow.")
}
if !hasBash44 {
t.Skip("bash 4.4 required to run")
if !hasBash50 {
t.Skip("bash 5.0 required to run")
}
i := 0
for _, c := range append(fileTests, fileTestsNoPrint...) {
Expand Down Expand Up @@ -211,8 +211,8 @@ func TestParseErrBashConfirm(t *testing.T) {
if testing.Short() {
t.Skip("calling bash is slow.")
}
if !hasBash44 {
t.Skip("bash 4.4 required to run")
if !hasBash50 {
t.Skip("bash 5.0 required to run")
}
i := 0
for _, c := range shellTests {
Expand Down

0 comments on commit 8fb18ad

Please sign in to comment.