From 946d5c58960b3e63ba1dc386669eed67ac868e78 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 21 Nov 2022 12:01:35 +0900 Subject: [PATCH] tests: suppress must_use warning and update cli_error output --- tests/test_alias.rs | 2 +- tests/test_global_opts.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_alias.rs b/tests/test_alias.rs index 77afa8229..3520d480a 100644 --- a/tests/test_alias.rs +++ b/tests/test_alias.rs @@ -50,7 +50,7 @@ fn test_alias_calls_unknown_command() { insta::assert_snapshot!(stderr, @r###" error: The subcommand 'nonexistent' wasn't recognized - Usage: jj [OPTIONS] [COMMAND] + Usage: jj [OPTIONS] For more information try '--help' "###); diff --git a/tests/test_global_opts.rs b/tests/test_global_opts.rs index ba9fe0bf8..711e0d114 100644 --- a/tests/test_global_opts.rs +++ b/tests/test_global_opts.rs @@ -45,8 +45,12 @@ fn test_non_utf8_arg() { #[test] fn test_no_subcommand() { let test_env = TestEnvironment::default(); - test_env.jj_cmd_cli_error(test_env.env_root(), &[]); - test_env.jj_cmd_cli_error(test_env.env_root(), &["-R."]); + + let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &[]); + insta::assert_snapshot!(stderr.lines().next().unwrap(), @"Jujutsu (An experimental VCS)"); + + let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["-R."]); + insta::assert_snapshot!(stderr.lines().next().unwrap(), @"error: 'jj' requires a subcommand but one was not provided"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["--version"]); insta::assert_snapshot!(stdout.replace(|c: char| c.is_ascii_digit(), "?"), @r###"