Fixing op precedences

This commit is contained in:
Mike Farah
2021-02-11 10:58:40 +11:00
parent 85ec32e3db
commit 9e56b364c2
5 changed files with 33 additions and 23 deletions
+6 -1
View File
@@ -12,6 +12,11 @@ var pathTests = []struct {
expectedTokens []interface{}
expectedPostFix []interface{}
}{
{
`.a | .b | .c`,
append(make([]interface{}, 0), "a", "PIPE", "b", "PIPE", "c"),
append(make([]interface{}, 0), "a", "b", "c", "PIPE", "PIPE"),
},
{
`[]`,
append(make([]interface{}, 0), "[", "]"),
@@ -190,7 +195,7 @@ func TestPathParsing(t *testing.T) {
}
var tokenValues []interface{}
for _, token := range tokens {
tokenValues = append(tokenValues, token.toString())
tokenValues = append(tokenValues, token.toString(false))
}
test.AssertResultComplexWithContext(t, tt.expectedTokens, tokenValues, fmt.Sprintf("tokenise: %v", tt.path))