From 7cc5fee687b09208d85dcad4fd6881737c1f1c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 25 Dec 2023 20:48:16 +0100 Subject: [PATCH] syntax: detect bash 5.2 rather than 5.1 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. --- syntax/parser.go | 2 +- syntax/parser_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/syntax/parser.go b/syntax/parser.go index 494808d2..d71950b4 100644 --- a/syntax/parser.go +++ b/syntax/parser.go @@ -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 diff --git a/syntax/parser_test.go b/syntax/parser_test.go index 2eb512e6..cf149860 100644 --- a/syntax/parser_test.go +++ b/syntax/parser_test.go @@ -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 @@ -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") } }