16 Commits

Author SHA1 Message Date
Yuya Nishihara
c83abc9dec tests: migrate non-snapshot users of jj_cmd_success() to run_jj_in().success() 2025-02-23 13:34:17 +00:00
Yuya Nishihara
2543329c78 tests: remove unused jj_cmd_panic() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
79a0867050 tests: migrate callers of jj_cmd_internal_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
b79b29c288 tests: migrate callers of jj_cmd_cli_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
d19e58f591 tests: migrate callers of jj_cmd_failure() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
696cfee55f tests: stop using assert_eq!() in cli tests where possible
Normalize the output instead.
2025-02-23 03:06:59 +00:00
Yuya Nishihara
18ea718113 tests: migrate some helper functions that uses jj_cmd_*() to run_jj_in()
Snapshotted operation IDs are changed because this patch reorders "jj new"
command arguments.
2025-02-22 01:23:04 +00:00
Yuya Nishihara
2581cd82be tests: migrate users of normalize_with() to run_jj_in() function 2025-02-21 01:49:41 +00:00
Yuya Nishihara
cf7f1dfc88 tests: migrate users of normalize_exit_status() to run_jj_in() function 2025-02-21 01:49:41 +00:00
Yuya Nishihara
53664ce2a4 tests: migrate jj_cmd_stdin*() to run_jj*() functions 2025-02-21 01:49:41 +00:00
Yuya Nishihara
de462a6268 tests: add helper to snapshot command output and exit status all at once
It's easier to review insta snapshot diffs than scanning panic log containing
lengthy output. I think this will also help printf debugging.

test_global_opts.rs is migrated to new API as an example.
2025-02-20 05:22:32 +00:00
Yuya Nishihara
740d8a2b1b tests: add #[must_use] to helper functions that return value to be tested 2025-02-20 05:22:32 +00:00
Yuya Nishihara
630036eeb0 tests: add [EOF] marker to command output when displaying
It's important to test that command output is (usually) terminated with newline,
but insta::assert_snapshot!() is lax about that.
2025-02-19 02:31:59 +00:00
Yuya Nishihara
a54165230a tests: add CommandOutputString wrapper
I'm going to add "[EOF]" marker to test that command output is terminated by
newline char. This patch ensures that callers who expect a raw output string
would never be affected by any normalization passes.

Some common normalization functions are extracted as CommandOutputString
methods.
2025-02-19 02:31:59 +00:00
Yuya Nishihara
0eddf5f3d6 tests: extract helper function that substitutes $TEST_ENV
I'm going to add wrapper type for normalized output, and this change makes
porting a bit easier.
2025-02-19 02:31:59 +00:00
Baltasar Dinis
769dbd8f5f cli/tests: move test environment to its own file
The `mod.rs` was becoming crowded and this makes way for unrelated
additions to the test utilities module
2025-02-11 13:46:25 +00:00