From 8a4b3966a6ff6b9cc1005c575d71bfc7771bced1 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Fri, 2 Feb 2024 22:08:00 -0800 Subject: [PATCH] test_global_opts: make test_version just a bit nicer when it fails --- cli/tests/test_global_opts.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index e656e4dab..8e4562290 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -48,10 +48,13 @@ fn test_version() { let stdout = test_env.jj_cmd_success(test_env.env_root(), &["--version"]); let sanitized = stdout.replace(|c: char| c.is_ascii_hexdigit(), "?"); + let expected = [ + "jj ?.??.?\n", + "jj ?.??.?-????????????????????????????????????????\n", + ]; assert!( - sanitized == "jj ?.??.?\n" - || sanitized == "jj ?.??.?-????????????????????????????????????????\n", - "{sanitized}" + expected.contains(&sanitized.as_str()), + "`jj version` output: {stdout:?}.\nSanitized: {sanitized:?}\nExpected one of: {expected:?}" ); }