-
Notifications
You must be signed in to change notification settings - Fork 499
/
undefined_variables.rs
102 lines (97 loc) · 1.72 KB
/
undefined_variables.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
use super::*;
#[test]
fn parameter_default_unknown_variable_in_expression() {
Test::new()
.justfile("foo a=(b+''):")
.stderr(
"
error: Variable `b` not defined
——▶ justfile:1:8
│
1 │ foo a=(b+''):
│ ^
",
)
.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
——▶ justfile:1:15
│
1 │ foo x=env_var(a):
│ ^
",
)
.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
——▶ justfile:1:26
│
1 │ foo x=env_var_or_default(a, b):
│ ^
",
)
.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
——▶ justfile:1:30
│
1 │ foo x=env_var_or_default('', b):
│ ^
",
)
.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
——▶ justfile:1:15
│
1 │ foo x=replace(a, b, c):
│ ^
",
)
.status(EXIT_FAILURE)
.run();
}