Protect install target and add tests

This commit is contained in:
2026-04-17 11:58:18 +08:00
parent bd6dc0279e
commit 479c416b2f
4 changed files with 84 additions and 2 deletions

View File

@@ -52,6 +52,8 @@ sudo iptables-forward
/usr/local/bin/iptables-forward -> /path/to/IPTables-Management/iptables-forward.sh
```
若目标路径已存在且不是当前仓库脚本的符号链接,`install.sh` 会拒绝覆盖;`--uninstall` 也只会删除当前脚本创建的链接,避免误删其它文件。
## 使用说明
### 交互模式
@@ -148,6 +150,7 @@ tests/run_all.sh --skip-integration
测试覆盖:
- `tests/test_cli.sh`:入口脚本与安装脚本帮助输出
- `tests/test_install.sh`:安装脚本的 install/uninstall 实际行为与误覆盖保护
- `tests/test_interactive.sh`:交互主菜单的 add/list/delete/save 回归
- `tests/test_common.sh`:输入校验
- `tests/test_storage.sh`:规则存储