···1212// See the License for the specific language governing permissions and
1313// limitations under the License.
14141515-use insta::assert_snapshot;
1616-1715use crate::common::TestEnvironment;
18161917#[test]
2018fn test_deprecated_flags() {
2119 let test_env = TestEnvironment::default();
2222- let (stdout, stderr) =
2323- test_env.jj_cmd_ok(test_env.env_root(), &["util", "completion", "--bash"]);
2424- assert_snapshot!(
2525- stderr,
2626- @r"
2020+ let output = test_env
2121+ .run_jj_in(test_env.env_root(), ["util", "completion", "--bash"])
2222+ .success();
2323+ insta::assert_snapshot!(output.stderr, @r"
2724 Warning: `jj util completion --bash` will be removed in a future version, and this will be a hard error
2825 Hint: Use `jj util completion bash` instead
2926 [EOF]
3030- "
3131- );
3232- assert!(stdout.raw().contains("COMPREPLY"));
2727+ ");
2828+ assert!(output.stdout.raw().contains("COMPREPLY"), "{output}");
3329}
+5-3
cli/tests/test_split_command.rs
···955955 ["", "next invocation\n", "write\nsecond-commit"].join("\0"),
956956 )
957957 .unwrap();
958958- let (_, stderr) = test_env.jj_cmd_ok(&main_path, &["split", "file2"]);
958958+ let output = test_env.run_jj_in(&main_path, ["split", "file2"]);
959959 match bookmark_behavior {
960960 BookmarkBehavior::Default | BookmarkBehavior::Modern => {
961961 insta::allow_duplicates! {
962962- insta::assert_snapshot!(stderr, @r"
962962+ insta::assert_snapshot!(output, @r"
963963+ ------- stderr -------
963964 First part: qpvuntsm 63d0c5ed *le-signet* | first-commit
964965 Second part: mzvwutvl a9f5665f second-commit
965966 Working copy now at: mzvwutvl a9f5665f second-commit
···978979 }
979980 BookmarkBehavior::Legacy => {
980981 insta::allow_duplicates! {
981981- insta::assert_snapshot!(stderr, @r"
982982+ insta::assert_snapshot!(output, @r"
983983+ ------- stderr -------
982984 Warning: `jj split` will leave bookmarks on the first commit in the next release.
983985 Warning: Run `jj config set --user split.legacy-bookmark-behavior false` to silence this message and use the new behavior.
984986 Warning: See https://github.com/jj-vcs/jj/issues/3419
+10-7
cli/tests/test_util_command.rs
···124124 fn test(shell: &str) {
125125 let test_env = TestEnvironment::default();
126126 // Use the local backend because GitBackend::gc() depends on the git CLI.
127127- let (out, err) = test_env.jj_cmd_ok(test_env.env_root(), &["util", "completion", shell]);
127127+ let output = test_env
128128+ .run_jj_in(test_env.env_root(), ["util", "completion", shell])
129129+ .success();
128130 // Ensures only stdout contains text
129129- assert!(!out.is_empty());
130130- assert!(err.is_empty());
131131+ assert!(
132132+ !output.stdout.is_empty() && output.stderr.is_empty(),
133133+ "{output}"
134134+ );
131135 }
132136133137 test("bash");
···140144fn test_util_exec() {
141145 let test_env = TestEnvironment::default();
142146 let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
143143- let (out, err) = test_env.jj_cmd_ok(
147147+ let output = test_env.run_jj_in(
144148 test_env.env_root(),
145145- &[
149149+ [
146150 "util",
147151 "exec",
148152 "--",
···151155 "hello",
152156 ],
153157 );
154154- insta::assert_snapshot!(out, @"hello[EOF]");
155158 // Ensures only stdout contains text
156156- assert!(err.is_empty());
159159+ insta::assert_snapshot!(output, @"hello[EOF]");
157160}
158161159162#[test]