mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-21 22:11:26 +08:00
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:
@@ -504,26 +504,18 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_text_asset_from_real_resource_file_when_available() {
|
||||
let path = Path::new(
|
||||
"/home/wanye/D/BlueArchive/AllResources/YostarGames/BlueArchive_JP/BlueArchive_Data/resources.assets",
|
||||
);
|
||||
if !path.exists() {
|
||||
return;
|
||||
}
|
||||
#[ignore = "requires BAT_REAL_RESOURCES_ASSETS pointing at a local resources.assets"]
|
||||
fn reads_text_asset_from_real_resource_file() {
|
||||
let path = std::env::var("BAT_REAL_RESOURCES_ASSETS")
|
||||
.expect("BAT_REAL_RESOURCES_ASSETS must be set");
|
||||
|
||||
let parsed = UnitySerializedFile::from_path(path).unwrap();
|
||||
let asset = parsed.text_asset("GameMainConfig").unwrap();
|
||||
let parsed =
|
||||
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.bytes.len(), 896);
|
||||
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,
|
||||
],
|
||||
);
|
||||
assert!(!asset.bytes.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user