Commit b2e6d88
authored
fix(interpreter): expand special variables ($#, $?, etc.) in arithmetic (#887)
## Summary
- Special variables like `$#`, `$?`, `$$` were not expanded inside `((
))` arithmetic because `expand_arithmetic_vars_depth` only consumed
alphanumeric/underscore chars after `$`
- Add handling for special variable characters (`#`, `?`, `$`, `!`, `@`,
`*`, `-`) in the arithmetic variable expansion
- Add spec tests `arith_special_var_hash` and
`arith_special_var_question`
## Test plan
- [x] New spec tests pass
- [x] All 1812 bash spec tests pass (100%)
- [x] Full `cargo test --all-features` passes
- [x] `cargo fmt --check` and `cargo clippy` clean
Closes #8761 parent 059eb85 commit b2e6d88
2 files changed
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7169 | 7169 | | |
7170 | 7170 | | |
7171 | 7171 | | |
| 7172 | + | |
| 7173 | + | |
| 7174 | + | |
| 7175 | + | |
| 7176 | + | |
| 7177 | + | |
| 7178 | + | |
| 7179 | + | |
| 7180 | + | |
| 7181 | + | |
| 7182 | + | |
7172 | 7183 | | |
7173 | 7184 | | |
7174 | 7185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
0 commit comments