-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simpler integration test for mactime2
- Loading branch information
Jan Starke
committed
Sep 22, 2023
1 parent
82f3330
commit 9d2838c
Showing
5 changed files
with
46 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,4 +162,4 @@ matches = "0.1" | |
# es4forensics | ||
assert-json-diff = "2.0" | ||
|
||
assert_cmd = "1" | ||
assert_cmd = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::{path::PathBuf, io::{BufReader, Cursor, BufRead}}; | ||
|
||
use assert_cmd::Command; | ||
use more_asserts::assert_le; | ||
|
||
#[test] | ||
fn is_sorted() { | ||
let mut cmd = Command::cargo_bin("mactime2").unwrap(); | ||
let mut data_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
data_path.push("tests"); | ||
data_path.push("data"); | ||
data_path.push("mactime2"); | ||
data_path.push("sample.bodyfile"); | ||
|
||
let result = cmd.arg("-d").arg("-b").arg(data_path).ok(); | ||
assert!(result.is_ok()); | ||
|
||
let reader = BufReader::new(Cursor::new(result.unwrap().stdout)); | ||
let mut previous_line = None; | ||
for line in reader.lines().map_while(Result::ok) { | ||
let comma_index = line.find(',').unwrap(); | ||
assert_eq!(comma_index, "2022-04-18T10:28:59+00:00".len()); | ||
let timestamp = line[..comma_index].to_owned(); | ||
if let Some(pv) = previous_line { | ||
assert_le!(pv, timestamp); | ||
} | ||
previous_line = Some(timestamp); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod help; | ||
mod autocomplete; | ||
mod autocomplete; | ||
mod is_sorted; |