-
Notifications
You must be signed in to change notification settings - Fork 499
/
constants.rs
60 lines (54 loc) · 957 Bytes
/
constants.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
use super::*;
#[test]
fn constants_are_defined() {
assert_eval_eq("HEX", "0123456789abcdef");
}
#[test]
fn constants_are_defined_in_recipe_bodies() {
Test::new()
.justfile(
"
@foo:
echo {{HEX}}
",
)
.stdout("0123456789abcdef\n")
.run();
}
#[test]
fn constants_are_defined_in_recipe_parameters() {
Test::new()
.justfile(
"
@foo hex=HEX:
echo {{hex}}
",
)
.stdout("0123456789abcdef\n")
.run();
}
#[test]
fn constants_can_be_redefined() {
Test::new()
.justfile(
"
HEX := 'foo'
",
)
.args(["--evaluate", "HEX"])
.stdout("foo")
.run();
}
#[test]
fn constants_are_not_exported() {
Test::new()
.justfile(
r#"
set export
foo:
@'{{just_executable()}}' --request '{"environment-variable": "HEXUPPER"}'
"#,
)
.response(Response::EnvironmentVariable(None))
.run();
}