Feat: Add test case covering empty string.
This commit is contained in:
@@ -28,3 +28,18 @@ fn find_content_in_file() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_empty_string() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let file = assert_fs::NamedTempFile::new("sample.txt")?;
|
||||
let content = "A test\nActual content\nMore content\nAnother test";
|
||||
file.write_str(content)?;
|
||||
|
||||
let mut cmd = Command::cargo_bin("grrs")?;
|
||||
cmd.arg("").arg(file.path());
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains(content));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user