aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-02 05:56:56 +0900
committernsfisis <nsfisis@gmail.com>2026-08-02 05:56:56 +0900
commit4fa973840f0a0e2cbb16f5e3341c0625793af2ed (patch)
tree6fcf9342ad97302fcb065e642309b6ccf81fe87c /crates/shirabe/tests
parent73911c5da18cd37761f90a15558d76d5742f38e5 (diff)
downloadphp-shirabe-4fa973840f0a0e2cbb16f5e3341c0625793af2ed.tar.gz
php-shirabe-4fa973840f0a0e2cbb16f5e3341c0625793af2ed.tar.zst
php-shirabe-4fa973840f0a0e2cbb16f5e3341c0625793af2ed.zip
refactor(php-shim): drop pack/unpack in favor of direct byte handling
The only callers were trivial fixed-format uses: reading the first four hash bytes as a native int, splitting in_addr byte strings, and building a constant ZIP EOCD record. Each site now does the byte manipulation directly, so the general-purpose shims are no longer needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests')
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_test.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/shirabe/tests/dependency_resolver/rule_test.rs b/crates/shirabe/tests/dependency_resolver/rule_test.rs
index 6bfb7bd1..9526bf39 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_test.rs
@@ -7,7 +7,7 @@ use shirabe::dependency_resolver::{
};
use shirabe::package::Link;
use shirabe::repository::RepositorySet;
-use shirabe_php_shim::{PHP_VERSION_ID, hash_raw, unpack};
+use shirabe_php_shim::{PHP_VERSION_ID, hash_raw};
use shirabe_semver::constraint::MatchAllConstraint;
fn root_require_reason() -> ReasonData {
@@ -35,12 +35,9 @@ fn test_get_hash() {
"sha1"
};
let binary = hash_raw(algo, "123");
- let hash = unpack("ihash", &binary).unwrap();
+ let hash = i32::from_ne_bytes(binary[..4].try_into().unwrap()) as i64;
- assert_eq!(
- hash.get("hash").unwrap().as_int(),
- rule.get_hash().unwrap().as_int()
- );
+ assert_eq!(Some(hash), rule.get_hash().unwrap().as_int());
}
#[test]