1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::utils::setup;
use assert_cmd::cargo::cargo_bin_cmd;
use std::fs;
use std::path::PathBuf;
/// Precondition: No input paths are provided.
/// Action: Run `pna experimental stdio -c -f ...` without positional paths.
/// Expectation: Command fails similarly to bsdtar's "missing file" handling.
#[test]
fn stdio_create_without_inputs_fails() {
setup();
let mut cmd = cargo_bin_cmd!("pna");
cmd.args([
"--quiet",
"experimental",
"stdio",
"--unstable",
"-c",
"-f",
"stdio_create_without_inputs_fails.pna",
]);
cmd.assert().failure();
}
/// Precondition: A directory exists but no real input files are specified.
/// Action: Run bsdtar create mode with only -C directory-change options
/// and zero file operands.
/// Expectation: Command fails — directory changes alone do not constitute input.
#[test]
fn stdio_create_with_only_directory_changes_fails() {
setup();
let base = PathBuf::from("stdio_create_only_dir_changes");
if base.exists() {
fs::remove_dir_all(&base).unwrap();
}
fs::create_dir_all(&base).unwrap();
cargo_bin_cmd!("pna")
.args([
"--quiet",
"compat",
"bsdtar",
"--unstable",
"-cf",
base.join("out.pna").to_str().unwrap(),
"-C",
base.to_str().unwrap(),
])
.assert()
.failure();
}