mirror of
https://github.com/casey/just.git
synced 2024-11-26 23:27:26 +03:00
19f7ad09a7
Add conditional expressions of the form: foo := if lhs == rhs { then } else { otherwise } `lhs`, `rhs`, `then`, and `otherwise` are all arbitrary expressions, and can recursively include other conditionals. Conditionals short-circuit, so the branch not taken isn't evaluated. It is also possible to test for inequality with `==`.
26 lines
473 B
Rust
26 lines
473 B
Rust
use crate::common::*;
|
|
|
|
test! {
|
|
name: expected_keyword,
|
|
justfile: "foo := if '' == '' { '' } arlo { '' }",
|
|
stderr: "
|
|
error: Expected keyword `else` but found identifier `arlo`
|
|
|
|
|
1 | foo := if '' == '' { '' } arlo { '' }
|
|
| ^^^^
|
|
",
|
|
status: EXIT_FAILURE,
|
|
}
|
|
|
|
test! {
|
|
name: unexpected_character,
|
|
justfile: "!~",
|
|
stderr: "
|
|
error: Expected character `=`
|
|
|
|
|
1 | !~
|
|
| ^
|
|
",
|
|
status: EXIT_FAILURE,
|
|
}
|