Skip to content

Commit

Permalink
fix: fixed ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Le0X8 committed Nov 19, 2024
1 parent 9db64af commit 5c2a957
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ crc32fast = "1.4.2"
dh = "0.8.0"
neozip = "0.3.1"
uu_mkdir = "0.0.28"

[dev-dependencies]
rici = { git = "https://github.com/Le0X8/rici.git", branch = "main" }
22 changes: 16 additions & 6 deletions tests/extract.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
use acridotheres::{archive::extract, formats::Format};
use dh::recommended::*;
use rici::rici;
use std::path::Path;

#[test]
fn zip_001() {
let ci = rici();

let output = Path::new(if ci {
std::fs::create_dir("output").unwrap();
"output/001-zip"
} else {
"tests/output/001-zip"
});

extract::extract_all(
Path::new("tests/samples/001.zip"),
Path::new("tests/output/001-zip"),
output,
Format::Zip,
1024,
)
.unwrap();

assert!(Path::new("tests/output/001-zip/test.txt").exists());
assert!(Path::new("tests/output/001-zip/test2.txt").exists());
assert!(output.join("test.txt").exists());
assert!(output.join("test2.txt").exists());

let mut test_txt = dh::file::open_r(Path::new("tests/output/001-zip/test.txt")).unwrap();
let mut test2_txt = dh::file::open_r(Path::new("tests/output/001-zip/test2.txt")).unwrap();
let mut test_txt = dh::file::open_r(output.join("test.txt")).unwrap();
let mut test2_txt = dh::file::open_r(output.join("test2.txt")).unwrap();

assert_eq!(test_txt.read_utf8_at(0, 14).unwrap(), "Hello, world!\n");
assert_eq!(test2_txt.read_utf8_at(0, 16).unwrap(), "Hello, world! 2\n");

test_txt.close().unwrap();
test2_txt.close().unwrap();

std::fs::remove_dir_all("tests/output/001-zip").unwrap();
std::fs::remove_dir_all(output).unwrap();
}

0 comments on commit 5c2a957

Please sign in to comment.