mirror of
https://github.com/Momoko-Ayase/Senbei.git
synced 2026-09-19 03:57:59 -04:00
Adopts the fork's workspace split (senbei-cli / senbei-crypto / senbei-io / senbei-metadata / senbei-pe), its structured error taxonomy, entry-transform and layout validation, PE32 dd8 key-formula selection with a skip floor, the CRT entry-stub dd8 oracle, and the extensionless-file scan skip. Kept from senbei on top of the restructure: - ManagedExe detection/routing and the CLR (COR20 + BSJB) metadata restore in the EXE pipeline. - The RET+int3 padding fingerprint as the primary dd8 padding signal, ahead of the mutated-position 0xCC fallback. - docs/, .github/, samples/, tests/ (moved to senbei-cli/tests), and the web/ wasm frontend (rewired to the split crates), all of which the fork had dropped. - The fork's README compatibility matrix is not taken: it names real games, which the public-repo hygiene rules forbid. - The wasm32 localtime fallback in logfile and unpack_bytes_force_exe (the web app's trap-recovery entry point), both lost in the restructure. Golden corpus: 35/35 byte-identical. clippy -D warnings clean; wasm32 check clean for the full workspace.
32 lines
872 B
Rust
32 lines
872 B
Rust
use senbei_io::job::{default_out_root_for_file, out_name};
|
|
use std::path::Path;
|
|
|
|
#[test]
|
|
fn out_name_inserts_unpack_before_last_dot() {
|
|
assert_eq!(out_name(Path::new("foo.exe")), Path::new("foo.unpack.exe"));
|
|
assert_eq!(
|
|
out_name(Path::new("a/b/bar.dll")),
|
|
Path::new("a/b/bar.unpack.dll")
|
|
);
|
|
assert_eq!(out_name(Path::new("x.y.dll")), Path::new("x.y.unpack.dll"));
|
|
}
|
|
|
|
#[test]
|
|
fn out_name_no_dot_appends_unpack() {
|
|
assert_eq!(out_name(Path::new("nodot")), Path::new("nodot.unpack"));
|
|
}
|
|
|
|
#[test]
|
|
fn default_out_root_for_file_is_parent_unpack() {
|
|
assert_eq!(
|
|
default_out_root_for_file(Path::new("a/b/foo.exe")),
|
|
Path::new("a/b/unpack")
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn default_out_root_for_file_cwd_when_no_parent() {
|
|
let p = default_out_root_for_file(Path::new("foo.exe"));
|
|
assert_eq!(p, Path::new(".").join("unpack"));
|
|
}
|