Skip to content

Commit

Permalink
interp: add TODOs about test operator precedence
Browse files Browse the repository at this point in the history
Spotted this parser issue when investigating #1036.
Note that parsing of [[ happens in the syntax parser,
but the classic [ test is done in the interpreter.
Both treat both binary operators as having the same precedence.
  • Loading branch information
mvdan committed Oct 14, 2023
1 parent 9477b02 commit 5544a66
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,8 @@ var runTests = []runTest{
{"set -n; [[ -o noexec ]]", ""}, // actually does nothing, but oh well
{"[[ -o pipefail ]]", "exit status 1"},
{"set -o pipefail; [[ -o pipefail ]]", ""},
// TODO: we don't implement precedence of && over ||.
// {"[[ a == x && b == x || c == c ]]", ""},

// classic test
{
Expand Down Expand Up @@ -1706,6 +1708,8 @@ var runTests = []runTest{
{"[ a != a ]", "exit status 1"},
{"[ abc = ab* ]", "exit status 1"},
{"[ abc != ab* ]", ""},
// TODO: we don't implement precedence of -a over -o.
// {"[ a = x -a b = x -o c = c ]", ""},

// arithm
{
Expand Down

0 comments on commit 5544a66

Please sign in to comment.