Skip to content

Commit

Permalink
test: ✅ 修复批量测试呈现问题
Browse files Browse the repository at this point in the history
修复「运行`cargo test --all-features`后,因『中途`clap`执行`process::exit`终止程序』或『cli运行时清屏』影响测试过程与结果呈现」的问题
  • Loading branch information
ARCJ137442 committed Jun 12, 2024
1 parent 33d2e94 commit 7646350
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bin/babelnar_cli/arg_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ mod tests {

/// 测试/打印帮助
#[test]
#[ignore = "【2024-06-12 23:46:44】会导致集成测试无法正常运行"]
fn test_arg_parse_help() {
_test_arg_parse(&["--help"], &CliArgs::default());
}

#[test]
#[ignore = "【2024-06-12 23:46:44】会导致集成测试无法正常运行"]
fn test_arg_parse_help2() {
_test_arg_parse(&["-h"], &CliArgs::default());
}
Expand Down Expand Up @@ -183,9 +186,16 @@ mod tests {

// 失败解析
fail_tests! {
#[ignore = "【2024-06-12 23:47:41】会导致集成测试无法正常运行"]
fail_缺少参数 test_arg_parse!(["-c"]);

#[ignore = "【2024-06-12 23:47:41】会导致集成测试无法正常运行"]
fail_参数名不对 test_arg_parse!(["--c"]);

#[ignore = "【2024-06-12 23:47:41】会导致集成测试无法正常运行"]
fail_缺少参数2 test_arg_parse!(["--config"]);

#[ignore = "【2024-06-12 23:47:41】会导致集成测试无法正常运行"]
多个参数没各自前缀 test_arg_parse!(["-c", "1", "2"]);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/bin/babelnar_cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ mod tests {
$(
$(#[$attr])*
#[test]
#[ignore = "【2024-06-12 23:52:35】不用于自动化测试:会自动清屏影响测试结果呈现"]
pub fn $name() -> Result<()> {
main_configs($cin_path, &[PRELUDE_TEST, $config_path])
}
Expand Down Expand Up @@ -402,6 +403,7 @@ mod tests {
/// * 🎯用户命令行交互体验(并存)
/// * 🎯Websocket通信
#[test]
#[ignore = "仅作试运行用,不用于自动化测试"]
pub fn main_websocket() -> Result<()> {
// 以默认参数启动
main_args(
Expand Down

0 comments on commit 7646350

Please sign in to comment.