test(adapters): 真实 resources.assets 测试改用环境变量注入

reads_text_asset_from_real_resource_file 原硬编码 /home/wanye 绝对路径,文件
不存在时静默 return——在其它机器/CI 上是永远跳过、从不断言的死测试。改为
#[ignore] + BAT_REAL_RESOURCES_ASSETS 环境变量注入(与仓库既有 real_* 测试一致),
并把机器特定的精确字节 golden 断言放宽为结构性断言(name 匹配、bytes 非空),
便于任意真实 resources.assets 显式运行。

对应 issue #18 维护清单 3-5。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-16 09:16:07 -07:00
co-authored by Claude Fable 5
parent fd86eafebd
commit 11f4c6c36e
+10 -18
View File
@@ -504,26 +504,18 @@ mod tests {
} }
#[test] #[test]
fn reads_text_asset_from_real_resource_file_when_available() { #[ignore = "requires BAT_REAL_RESOURCES_ASSETS pointing at a local resources.assets"]
let path = Path::new( fn reads_text_asset_from_real_resource_file() {
"/home/wanye/D/BlueArchive/AllResources/YostarGames/BlueArchive_JP/BlueArchive_Data/resources.assets", let path = std::env::var("BAT_REAL_RESOURCES_ASSETS")
); .expect("BAT_REAL_RESOURCES_ASSETS must be set");
if !path.exists() {
return;
}
let parsed = UnitySerializedFile::from_path(path).unwrap(); let parsed =
let asset = parsed.text_asset("GameMainConfig").unwrap(); UnitySerializedFile::from_path(Path::new(&path)).expect("parse local resources.assets");
let asset = parsed
.text_asset("GameMainConfig")
.expect("GameMainConfig TextAsset present");
assert_eq!(asset.name, "GameMainConfig"); assert_eq!(asset.name, "GameMainConfig");
assert_eq!(asset.bytes.len(), 896); assert!(!asset.bytes.is_empty());
assert_eq!(
&asset.bytes[..32],
&[
0x60, 0x23, 0x0a, 0x06, 0x95, 0x72, 0x83, 0x57, 0x54, 0x23, 0x49, 0x06, 0xfc, 0x72,
0xb4, 0x57, 0x57, 0x23, 0x6b, 0x06, 0x98, 0x72, 0xb5, 0x57, 0x71, 0x23, 0x1b, 0x06,
0xec, 0x72, 0xf6, 0x57,
],
);
} }
} }