Skip to content

Commit da6c0ad

Browse files
committed
test: write integration tets for print with format flag
1 parent bd27265 commit da6c0ad

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/cli.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,16 @@ fn test_add_with_process() -> Result<(), Box<dyn std::error::Error>> {
314314
Ok(())
315315
}
316316

317-
// TODO: add tests for commands with --global flag
317+
#[test]
318+
/// Test for print command with custom format
319+
fn print_with_custom_format() -> Result<(), Box<dyn std::error::Error>> {
320+
let mut cmd = Command::cargo_bin("envfetch")?;
321+
unsafe { env::set_var("FORMAT_TEST", "Hello") };
322+
cmd.arg("print")
323+
.arg("--format")
324+
.arg("{name}={value}")
325+
.assert()
326+
.success()
327+
.stdout(predicate::str::contains("FORMAT_TEST=Hello"));
328+
Ok(())
329+
}

0 commit comments

Comments
 (0)