Skip to content

Commit

Permalink
syntax: detect bash 5.2 rather than 5.1
Browse files Browse the repository at this point in the history
5.2 was released in late 2022.
We track any changes we might need in our parser via #921,
and aside from that all existing bash tests still pass with 5.2.
  • Loading branch information
mvdan committed Dec 25, 2023
1 parent 4ffd815 commit 7cc5fee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion syntax/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
// LangBash corresponds to the GNU Bash language, as described in its
// manual at https://www.gnu.org/software/bash/manual/bash.html.
//
// We currently follow Bash version 5.1.
// We currently follow Bash version 5.2.
//
// Its string representation is "bash".
LangBash LangVariant = iota
Expand Down
10 changes: 5 additions & 5 deletions syntax/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ func TestMain(m *testing.M) {
}

var (
storedHasBash51 bool
onceHasBash51 sync.Once
storedHasBash52 bool
onceHasBash52 sync.Once

storedHasDash059 bool
onceHasDash059 sync.Once
Expand All @@ -174,10 +174,10 @@ var (
)

func hasBash51(tb testing.TB) {
onceHasBash51.Do(func() {
storedHasBash51 = cmdContains("version 5.1", "bash", "--version")
onceHasBash52.Do(func() {
storedHasBash52 = cmdContains("version 5.2", "bash", "--version")
})
if !storedHasBash51 {
if !storedHasBash52 {
tb.Skipf("bash 5.1 required to run")
}
}
Expand Down

0 comments on commit 7cc5fee

Please sign in to comment.