mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 07:24:55 +08:00
补充 JSON/compact catalog 的 provider ID、bundle name、资源类型、hash、size、CRC 和依赖字段,并贯通 ResourceEntry、SQLite 资源索引和回归 golden。对 compact extra data 与 resource type index 的损坏返回明确错误,不再把 bundle name 当作 hash fallback。\n\n验证:cargo fmt --check;cargo test -p bat-core --locked;cargo test -p bat-adapters --locked;cargo test -p bat-infrastructure --locked;git diff --check。\n\nClippy 仍受既有 core/src/domain/game_client.rs:141 的 needless-question-mark 和 items-after-test-module 基线问题影响,未混入本 issue 修复。\n\nFixes #2
38 lines
1.4 KiB
Rust
38 lines
1.4 KiB
Rust
use bat_adapters::manifest::ManifestDriverRegistry;
|
|
use serde_json::json;
|
|
|
|
#[tokio::test]
|
|
async fn parses_real_shape_addressables_catalog_against_golden() {
|
|
let catalog = include_str!("fixtures/real_addressables/catalog.json");
|
|
let manifest = ManifestDriverRegistry::with_defaults()
|
|
.parse(catalog.as_bytes())
|
|
.await
|
|
.expect("parse real-shape Addressables catalog");
|
|
|
|
let actual = json!({
|
|
"format": format!("{:?}", manifest.format),
|
|
"locator_id": manifest.metadata.locator_id,
|
|
"cdn_prefixes": manifest.metadata.cdn_prefixes,
|
|
"resource_count": manifest.resources.len(),
|
|
"resources": manifest.resources.iter().map(|resource| {
|
|
json!({
|
|
"path": resource.path,
|
|
"hash": resource.hash,
|
|
"size": resource.size,
|
|
"resource_type": format!("{:?}", resource.resource_type),
|
|
"address": resource.address,
|
|
"dependencies": resource.dependencies,
|
|
"provider_id": resource.provider_id,
|
|
"bundle_name": resource.bundle_name,
|
|
"crc": resource.crc,
|
|
})
|
|
}).collect::<Vec<_>>(),
|
|
"metadata": manifest.metadata.extra,
|
|
});
|
|
|
|
let expected: serde_json::Value =
|
|
serde_json::from_str(include_str!("golden/real_addressables.json")).unwrap();
|
|
|
|
assert_eq!(actual, expected);
|
|
}
|