tests(cli): add test coverage for jj run stub command#9016
tests(cli): add test coverage for jj run stub command#9016RajPabnani03 wants to merge 2 commits into
jj run stub command#9016Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I'm sorry, but I don't think we need tests for a stub command. I'm very tempted to close this. |
Adds `cli/tests/test_run_command.rs` with 6 tests covering the `jj run` stub command: - `test_run_is_stub` — baseline: correct stub error is returned - `test_run_accepts_jobs_flag` — --jobs / -j flags are parsed without error - `test_run_accepts_revset_flag` — -r flag resolves a valid revset before stub - `test_run_accepts_hidden_x_flag` — hidden -x compat flag is accepted silently - `test_run_outside_repo` — workspace check fires before stub is reached - `test_run_invalid_revset` — bad revset yields parse error, not stub error The tests document the CLI contract for the stub: flag parsing and revision resolution are exercised, and the stub error is always the terminal failure for valid invocations inside a repository. This acts as a regression guard so that any future activation of real `run` logic must update these tests. https://claude.ai/code/session_019cMU6DHSWoMYw4sP3hVP4D
Move `mod test_run_command` to its correct position after `mod test_root` and before `mod test_show_command`, matching the alphabetical ordering convention used throughout the file. https://claude.ai/code/session_019cMU6DHSWoMYw4sP3hVP4D
8df0adc to
8b0d5e7
Compare
It being mostly AI generated also is something you should consider in this. |
|
I'm fine with it being AI generated as long as the quality is good and the author doesn't just throw it over the wall and waste the reviewer's time by having the reviewer find all the problems the author should have found before sending it. That's basically what the proposed policy in #8897 says. |
|
@RajPabnani03: I just realized that my comment above could have been interpreted as being directed at you, so I wanted to clarify that it wasn't. I have only spent a few seconds looking at the code, so I couldn't say if it was well written. I think it's just not time for tests of the |
Summary
cli/tests/test_run_command.rswith 6 tests covering thejj runstub commandmod test_run_commandinrunner.rsin correct alphabetical orderBackground
jj runis a stub command that unconditionally returns"This is a stub, do not use"afterperforming argument parsing and revision resolution. It had zero test coverage, identified
during a broader test-coverage audit of the codebase.
Tests added
test_run_is_stubtest_run_accepts_jobs_flag--jobs N/-j Nare parsed without a spurious pre-stub errortest_run_accepts_revset_flag-r @resolves the revset before the stub is reachedtest_run_accepts_hidden_x_flag-xcompat flag (mirrorsgit rebase -x) is silently acceptedtest_run_outside_repoworkspace_helpercheck fires before the stub — returns "no jj repo" errortest_run_invalid_revsetWhy test a stub?
tests, making the activation visible in review rather than silently activating.
--jobs,--revisions,-x) and their accepted valuesare part of the public CLI surface even before the command is implemented.
workspace_helpertakes priority over the stub forout-of-repo invocations.
Test plan
cargo test --package jj-cli --test runner test_runtest_no_forgotten_test_filesguard passes