Files
BlueArchiveToolkit/crates/bat-patch/src/binary.rs
T
nyaKazuhaandClaude Fable 5 02d5bc537e fix(patch): 占位函数返回未实现错误而非空结果
apply_patch / apply_json_patch 原返回 Ok(空 Vec/空 String),调用方会把未实现
的占位误当成一次成功的补丁应用。改为返回 PatchError::ApplyFailed,让占位状态
显式可见。新增单测确认返回错误。

对应 issue #18 维护清单 2-4。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 08:00:31 -07:00

23 lines
640 B
Rust

//! Binary Patch 模块占位
/// Binary Patch 应用(尚未实现)。
///
/// 返回 [`crate::PatchError::ApplyFailed`] 而非空结果,避免调用方把未实现的
/// 占位当成一次成功的补丁应用。
pub fn apply_patch(_old: &[u8], _patch: &[u8]) -> crate::Result<Vec<u8>> {
Err(crate::PatchError::ApplyFailed(
"binary patch 尚未实现".to_string(),
))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn apply_patch_reports_not_implemented() {
let error = apply_patch(b"old", b"patch").unwrap_err();
assert!(matches!(error, crate::PatchError::ApplyFailed(_)));
}
}