docs: 补齐各模块局部回归测试的输入与断言说明

This commit is contained in:
2026-11-12 10:34:22 +08:00
parent e315172ce1
commit 45ff965b01
12 changed files with 29 additions and 2 deletions
+3
View File
@@ -301,6 +301,7 @@ fn send(input: &Input) -> anyhow::Result<()> {
mod tests {
use super::*;
#[test]
/// 重复消费旧帧捕获的连续 pan,允许刷新到当前版本且保留每条 delta;离散 click 不改版本,会话/目标替换拒绝手势。
fn queued_native_pan_keeps_each_delta_and_rejects_replaced_targets() {
let (mut session, document) = crate::endor_host::ReplSession::load(
"view=CanvasViewport(200,100,Scene2D(RectBlock(20,20,0)))\npage=Page()\npage.render(view)",
@@ -352,6 +353,7 @@ mod tests {
assert!(!refresh_continuous_input(&mut original.clone(), &current));
}
#[test]
/// 对 tab-drop 元数据、位置上限与 tab-detach 桌面坐标逐项改坏,检查辅助字段只在对应事件类型和预算内合法。
fn drop_metadata_is_scoped_to_its_event_kind_and_bounded() {
let mut input:Input=serde_json::from_str(r#"{"window":1,"session":1,"layout_version":2,"mount":3,"kind":"tab-drop","tab_drop":{"window":2,"layout_version":4,"index":1}}"#).unwrap();
assert!(input.validate().is_ok());
@@ -369,6 +371,7 @@ mod tests {
}
#[test]
/// 旧 JSON 未带 window 时默认主窗口以保持兼容;显式 window=0 仍是非法资源,不能当成默认值。
fn legacy_event_window_defaults_but_zero_is_never_a_resource() {
let mut input: Input =
serde_json::from_str(r#"{"session":1,"layout_version":2,"mount":3,"kind":"focus"}"#)
+1
View File
@@ -155,6 +155,7 @@ mod tests {
use super::*;
use endor_core::{ExecutionLimits, Vm};
#[test]
/// 生成超过单字节跳距的循环,false 条件正常返回,true 条件只耗尽指令预算而非一帧预算;释放后对象数归零。
fn repeated_bytecode_handles_extended_operands_and_keeps_one_frame() {
// 300 个 Nop 强制跨越单字节跳转距离:false 应正常退出;true 应耗尽指令预算,
// 而非耗尽帧预算,从而验证循环确实复用同一个执行帧。