Fix builtin test assigning wrong range to "! -d /" (Rust port regression)

Fixes #11387
This commit is contained in:
Johannes Altmanninger
2025-04-16 09:44:26 +02:00
parent 721c9a2c14
commit c740c656a8
2 changed files with 8 additions and 1 deletions

View File

@@ -684,10 +684,11 @@ fn parse_4_arg_expression(
if let Token::UnaryBoolean(token) = first_token {
let subject = self.parse_3_arg_expression(start + 1, end)?;
let range = start..subject.range().end;
UnaryOperator {
subject,
token,
range: start..end,
range,
}
.into_some_box()
} else if first_token == Token::ParenOpen {

View File

@@ -99,6 +99,12 @@ fn test_test() {
assert!(run_test_test(1, &["!", "15", "-ge", "10"]));
assert!(run_test_test(0, &["!", "!", "15", "-ge", "10"]));
assert!(run_test_test(0, &[
"(", "-d", "/", ")",
"-o",
"(", "!", "-d", "/", ")",
]));
assert!(run_test_test(0, &["0", "-ne", "1", "-a", "0", "-eq", "0"]));
assert!(run_test_test(0, &["0", "-ne", "1", "-a", "-n", "5"]));
assert!(run_test_test(0, &["-n", "5", "-a", "10", "-gt", "5"]));