test: 全模式功能测试覆盖 (12模式 33项测试)

新增 arc/eng/do/dbg/ctx/xdb/sdb/ndb/dep/tst/sec/rvr 全模式功能测试;
fix do_mode UI 检测中文关键词补全;scripts/install.sh 同步更新。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
AirLongDian
2026-06-11 10:10:57 +08:00
parent 211d50de49
commit 19a4550830
9 changed files with 1166 additions and 1 deletions

90
test_xdb_sdb_ndb.py Normal file
View File

@@ -0,0 +1,90 @@
#!/usr/bin/env python3
"""Xdb/Sdb/Ndb Mode 功能测试"""
import sys
import os
import tempfile
import json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent / "lib"))
def test_xdb_enter():
"""测试 GUI 验证器初始化"""
from air_runtime.modes.xdb_sdb_ndb_modes import xdb_enter
with tempfile.TemporaryDirectory() as tmpdir:
project_root = Path(tmpdir)
result = xdb_enter(project_root)
assert "state_path" in result
assert Path(result["state_path"]).exists()
print("✓ Xdb 初始化测试通过")
return True
def test_sdb_enter():
"""测试静态分析器初始化"""
from air_runtime.modes.xdb_sdb_ndb_modes import sdb_enter
with tempfile.TemporaryDirectory() as tmpdir:
project_root = Path(tmpdir)
result = sdb_enter(project_root)
assert "state_path" in result
assert Path(result["state_path"]).exists()
print("✓ Sdb 初始化测试通过")
return True
def test_ndb_enter():
"""测试网络调试器初始化"""
from air_runtime.modes.xdb_sdb_ndb_modes import ndb_enter
with tempfile.TemporaryDirectory() as tmpdir:
project_root = Path(tmpdir)
result = ndb_enter(project_root)
assert "state_path" in result
assert Path(result["state_path"]).exists()
print("✓ Ndb 初始化测试通过")
return True
def main():
print("=" * 50)
print("Xdb/Sdb/Ndb Mode 功能测试")
print("=" * 50)
tests = [
("Xdb 初始化", test_xdb_enter),
("Sdb 初始化", test_sdb_enter),
("Ndb 初始化", test_ndb_enter),
]
passed = 0
failed = 0
for name, test_fn in tests:
try:
test_fn()
passed += 1
except Exception as e:
print(f"{name} 失败: {e}")
import traceback
traceback.print_exc()
failed += 1
print("=" * 50)
print(f"测试结果: {passed} 通过, {failed} 失败")
print("=" * 50)
return failed == 0
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)