Skip to content

Commit

Permalink
add CLI test for 0 length read in slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Rigo committed Mar 2, 2024
1 parent 7648b48 commit 25aae81
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sliceapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl SliceApplet {
f.seek(SeekFrom::Start(self.start))
.with_context(|| "seek failed")?;
}

let mut res = vec![];
if self.end.is_some() {
let end = self.end.unwrap();
Expand Down Expand Up @@ -315,5 +316,13 @@ mod tests {
.assert()
.stdout("")
.failure();

assert_cmd::Command::cargo_bin("rsbkb")
.expect("Could not run binary")
.args(&["slice", "-", "0", "0"])
.write_stdin(&data)
.assert()
.stdout(&b""[..])
.success();
}
}

0 comments on commit 25aae81

Please # to comment.