From f009610103f6dfe8459b9c349743f0af0516da8a Mon Sep 17 00:00:00 2001 From: Talison Fabio <54823205+talis-fb@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:52:55 -0300 Subject: [PATCH] fix: revert remove unpack_rar_stdin test --- tests/integration.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index 7bc0c52..c39cc60 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -435,6 +435,43 @@ fn unpack_rar() -> Result<(), Box> { } #[cfg(feature = "unrar")] +#[test] +fn unpack_rar_stdin() -> Result<(), Box> { + fn test_unpack_rar_single(input: &std::path::Path, format: &str) -> Result<(), Box> { + let dir = tempdir()?; + let dirpath = dir.path(); + let unpacked_path = &dirpath.join("testfile.txt"); + crate::utils::cargo_bin() + .args([ + "-A", + "-y", + "d", + "-", + "-d", + dirpath.to_str().unwrap(), + "--format", + format, + ]) + .pipe_stdin(input) + .unwrap() + .assert() + .success(); + let content = fs::read_to_string(unpacked_path)?; + assert_eq!(content, "Testing 123\n"); + + Ok(()) + } + + let mut datadir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?); + datadir.push("tests/data"); + [("testfile.rar3.rar.gz", "rar.gz"), ("testfile.rar5.rar", "rar")] + .iter() + .try_for_each(|(path, format)| test_unpack_rar_single(&datadir.join(path), format))?; + + Ok(()) +} + + #[proptest(cases = 25)] fn symlink_pack_and_unpack( ext: DirectoryExtension,