Skip to content

Commit a8e208e

Browse files
committed
tests: Check nft command line arguments
1 parent dda32bd commit a8e208e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/stubs/nft.rs

+14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@
88

99
#![forbid(unsafe_code)]
1010

11+
use std::{
12+
env,
13+
io::{stdin, Read as _},
14+
};
15+
1116
fn main() {
17+
let args: Vec<String> = env::args().collect();
18+
assert_eq!(args, ["nft", "-j", "-f", "-"]);
19+
20+
let mut json_raw: Vec<u8> = vec![];
21+
stdin().read_to_end(&mut json_raw).unwrap();
22+
let json = std::str::from_utf8(&json_raw).unwrap();
23+
24+
//eprintln!("{json:?}");
25+
let _ = json; // We could have some json payload checks here...
1226
}
1327

1428
// vim: ts=4 sw=4 expandtab

0 commit comments

Comments
 (0)