Skip to content

Commit 9065d50

Browse files
committed
Assert not in env function
1 parent f5aaab8 commit 9065d50

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

ā€Žtests/attributes.rsā€Ž

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,32 @@ baz x=`echo ${foo}.txt`:
356356
.run();
357357
}
358358

359+
#[test]
360+
fn env_attribute_not_in_env_function() {
361+
Test::new()
362+
.justfile(
363+
r#"
364+
365+
[env("foo", "bar")]
366+
baz:
367+
@echo {{ env("foo") }}.txt
368+
369+
"#,
370+
)
371+
.stderr(
372+
r#"
373+
error: Call to function `env` failed: environment variable `foo` not present
374+
——▶ justfile:4:12
375+
│
376+
4 │ @echo {{ env("foo") }}.txt
377+
│ ^^^
378+
379+
"#,
380+
)
381+
.status(EXIT_FAILURE)
382+
.run();
383+
}
384+
359385
#[test]
360386
fn env_attribute_too_few_arguments() {
361387
Test::new()

0 commit comments

Comments
Ā (0)
⚔