2022-06-19 07:56:31 +03:00
|
|
|
use super::*;
|
2021-10-09 08:04:13 +03:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn parameter_default_unknown_variable_in_expression() {
|
|
|
|
Test::new()
|
|
|
|
.justfile("foo a=(b+''):")
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Variable `b` not defined
|
2023-12-30 00:25:30 +03:00
|
|
|
——▶ justfile:1:8
|
|
|
|
│
|
|
|
|
1 │ foo a=(b+''):
|
|
|
|
│ ^
|
2021-10-09 08:04:13 +03:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unknown_variable_in_unary_call() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
foo x=env_var(a):
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Variable `a` not defined
|
2023-12-30 00:25:30 +03:00
|
|
|
——▶ justfile:1:15
|
|
|
|
│
|
|
|
|
1 │ foo x=env_var(a):
|
|
|
|
│ ^
|
2021-10-09 08:04:13 +03:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unknown_first_variable_in_binary_call() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
foo x=env_var_or_default(a, b):
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Variable `a` not defined
|
2023-12-30 00:25:30 +03:00
|
|
|
——▶ justfile:1:26
|
|
|
|
│
|
|
|
|
1 │ foo x=env_var_or_default(a, b):
|
|
|
|
│ ^
|
2021-10-09 08:04:13 +03:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unknown_second_variable_in_binary_call() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
foo x=env_var_or_default('', b):
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Variable `b` not defined
|
2023-12-30 00:25:30 +03:00
|
|
|
——▶ justfile:1:30
|
|
|
|
│
|
|
|
|
1 │ foo x=env_var_or_default('', b):
|
|
|
|
│ ^
|
2021-10-09 08:04:13 +03:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unknown_variable_in_ternary_call() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
foo x=replace(a, b, c):
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Variable `a` not defined
|
2023-12-30 00:25:30 +03:00
|
|
|
——▶ justfile:1:15
|
|
|
|
│
|
|
|
|
1 │ foo x=replace(a, b, c):
|
|
|
|
│ ^
|
2021-10-09 08:04:13 +03:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|