mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-17 08:01:14 -03:00
tinyexpr: report errors for extra args in parens correctly.
Usages like `math (1 1)` should report too many arguments, same as `math 1 1`. Check for these cases and add tests. Fixes #8511
This commit is contained in:
@@ -129,6 +129,18 @@ not math '2 + 2 4'
|
||||
# CHECKERR: math: Error: Too many arguments
|
||||
# CHECKERR: '2 + 2 4'
|
||||
# CHECKERR: ^
|
||||
not math '(1 2)'
|
||||
# CHECKERR: math: Error: Too many arguments
|
||||
# CHECKERR: '(1 2)'
|
||||
# CHECKERR: ^
|
||||
not math '(1 pi)'
|
||||
# CHECKERR: math: Error: Too many arguments
|
||||
# CHECKERR: '(1 pi)'
|
||||
# CHECKERR: ^
|
||||
not math '(1 pow 1,2)'
|
||||
# CHECKERR: math: Error: Too many arguments
|
||||
# CHECKERR: '(1 pow 1,2)'
|
||||
# CHECKERR: ^
|
||||
not math
|
||||
# CHECKERR: math: expected >= 1 arguments; got 0
|
||||
not math -s 12
|
||||
@@ -182,6 +194,11 @@ math 'log(16'
|
||||
# CHECKERR: 'log(16'
|
||||
# CHECKERR: ^
|
||||
|
||||
math '(2'
|
||||
# CHECKERR: math: Error: Missing closing parenthesis
|
||||
# CHECKERR: '(2'
|
||||
# CHECKERR: ^
|
||||
|
||||
math --base=16 255 / 15
|
||||
# CHECK: 0x11
|
||||
math -bhex 16 x 2
|
||||
|
||||
Reference in New Issue
Block a user