jj/cli/tests
Jonas Greitemann 4a1754bc46 config-schema: deny empty arrays for command-like config options
Anytime an external tool is referenced in the config, the command can be
provided as a string or as a token array. In the latter case, the array
must not be empty; at least the command name must be provided.

The schema didn't previously object to an empty array, though; this has
now been rectified. I've added more sample configs to cover this case.
Those same configs can also be used to illustrate that this is indeed
jj's current behavior:

$ jj --config-file cli/tests/sample-configs/invalid/ui.pager_empty_array.toml show
Config error: Invalid type or value for ui.pager
Caused by: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/ui.pager.command_empty_array.toml show
Config error: Invalid type or value for ui.pager
Caused by: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/ui.editor_empty_array.toml config edit --user
Config error: Invalid type or value for ui.editor
Caused by: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/ui.diff-editor_empty_array.toml split
Error: Failed to load tool configuration
Caused by:
1: Invalid type or value for ui.diff-editor
2: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/ui.merge-editor_empty_array.toml resolve
Error: Failed to load tool configuration
Caused by:
1: Invalid type or value for ui.merge-editor
2: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/ui.diff.tool_empty_array.toml diff
Config error: Invalid type or value for ui.diff.tool
Caused by: data did not match any variant of untagged enum CommandNameAndArgs
                                                                                                                                                                                  
$ jj --config-file cli/tests/sample-configs/invalid/fix.tools.command_empty_array.toml fix
Config error: Invalid type or value for fix.tools.black
Caused by: data did not match any variant of untagged enum CommandNameAndArgs
in `command`

As a notable exception, `ui.default-command` *is* allowed to be an empty
array. In that case, `jj` will print a usage message. This is also
covered by a valid sample config.
2025-04-24 15:48:08 +00:00
..
common tests: allow overriding more environment variables 2025-04-13 13:55:09 +00:00
sample-configs config-schema: deny empty arrays for command-like config options 2025-04-24 15:48:08 +00:00
cli-reference@.md.snap cli: duplicate: add setting for templating the new commit descriptions 2025-04-13 21:49:47 +00:00
datatest_runner.rs config-schema: add sample config files to exercise schema tests 2025-04-24 15:48:08 +00:00
runner.rs config-schema: use datatest-stable crate to instantiate tests 2025-04-24 15:48:08 +00:00
test_abandon_command.rs abandon: convert deleted bookmark warning to hint 2025-04-11 01:35:07 +00:00
test_absorb_command.rs absorb: add basic support for file deletion 2025-04-17 18:10:23 +00:00
test_acls.rs tests: port test_acls.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
test_advance_bookmarks.rs tests: port test_advance_bookmarks.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
test_alias.rs cli: add revert command 2025-03-17 15:03:29 +00:00
test_backout_command.rs cli: deprecate backout command 2025-03-17 15:03:29 +00:00
test_bookmark_command.rs cli: Add config setting for bookmark list sort order 2025-04-08 08:06:29 +00:00
test_builtin_aliases.rs tests: port test_builtin_aliases.rs to TestWorkDir API 2025-03-13 03:45:45 +00:00
test_commit_command.rs config: migrate ui.default-description to template alias 2025-04-21 14:39:47 +00:00
test_commit_template.rs templates: add commonly used trailers 2025-04-15 05:16:16 +00:00
test_completion.rs templates: extract a template alias as hook for default commit description 2025-04-19 05:42:52 +00:00
test_concurrent_operations.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_config_command.rs tests: add work_dir.dir(path), make create_dir*() return helper for sub dir 2025-03-18 01:25:08 +00:00
test_config_schema.rs config-schema: add sample config files to exercise schema tests 2025-04-24 15:48:08 +00:00
test_copy_detection.rs tests: port test_copy_detection.rs to TestWorkDir API 2025-03-13 16:13:12 +00:00
test_debug_command.rs tests: add work_dir.dir(path), make create_dir*() return helper for sub dir 2025-03-18 01:25:08 +00:00
test_debug_init_simple_command.rs lib: rename the LocalBackend to SimpleBackend 2025-03-17 17:17:11 +00:00
test_describe_command.rs config: migrate ui.default-description to template alias 2025-04-21 14:39:47 +00:00
test_diff_command.rs copies: ignore existing tree when testing copy/rename operation type 2025-04-22 00:44:13 +00:00
test_diffedit_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_duplicate_command.rs cli: duplicate: add setting for templating the new commit descriptions 2025-04-13 21:49:47 +00:00
test_edit_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_evolog_command.rs templates: extract a template alias as hook for default commit description 2025-04-19 05:42:52 +00:00
test_file_annotate_command.rs tests: port test_file_annotate_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
test_file_chmod_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_file_show_command.rs tests: port test_file_show_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
test_file_track_untrack_commands.rs tests: port test_file_track_untrack_commands.rs to TestWorkDir API 2025-03-19 14:52:52 +00:00
test_fix_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_generate_md_cli_help.rs tests: resolve directory path to run_jj_in() relative to env_root 2025-02-25 15:40:14 +00:00
test_git_clone.rs git: work around gix global remote configuration issue 2025-04-13 13:55:09 +00:00
test_git_colocated.rs cargo: bump gix to 0.71.0 2025-04-04 04:28:42 +00:00
test_git_fetch.rs git: add deprecation warnings for git.subprocess 2025-04-08 10:36:46 +00:00
test_git_import_export.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_git_init.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_git_private_commits.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_git_push.rs cli: git-push: do not move existing local bookmarks by --change 2025-04-19 01:26:40 +00:00
test_git_remotes.rs git: work around gix global remote configuration issue 2025-04-13 13:55:09 +00:00
test_git_root.rs cli: git: add git root command 2025-03-25 08:58:43 +00:00
test_gitignores.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_global_opts.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_help_command.rs cli: add revert command 2025-03-17 15:03:29 +00:00
test_immutable_commits.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_interdiff_command.rs diff: add option to render color-words diffs without materializing conflicts 2025-04-08 09:12:39 +00:00
test_log_command.rs templates: extract a template alias as hook for default commit description 2025-04-19 05:42:52 +00:00
test_new_command.rs new: add trailer support 2025-04-17 13:29:49 +00:00
test_next_prev_commands.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_operations.rs templates: extract a template alias as hook for default commit description 2025-04-19 05:42:52 +00:00
test_parallelize_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_rebase_command.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_repo_change_report.rs cli: Print @ and @- in status and print_updated_working_copy_stats 2025-03-31 11:57:04 +00:00
test_resolve_command.rs cli: resolve: do not use .with_new_file_ids() to construct resolved file value 2025-04-13 02:02:58 +00:00
test_restore_command.rs tests: port test_restore_command.rs to TestWorkDir API 2025-04-01 15:00:17 +00:00
test_revert_command.rs tests: port test_revert_command.rs to TestWorkDir API 2025-04-01 15:00:17 +00:00
test_revset_output.rs tests: port test_revset_output.rs to TestWorkDir API 2025-04-01 15:00:17 +00:00
test_root.rs lib: rename the LocalBackend to SimpleBackend 2025-03-17 17:17:11 +00:00
test_shell_completion.rs tests: resolve directory path to run_jj_in() relative to env_root 2025-02-25 15:40:14 +00:00
test_show_command.rs templates: extract a template alias as hook for default commit description 2025-04-19 05:42:52 +00:00
test_sign_unsign_commands.rs tests: port test_sign_unsign_commands.rs to TestWorkDir API 2025-04-03 01:43:02 +00:00
test_simplify_parents_command.rs tests: port test_simplify_parents_command.rs to TestWorkDir API 2025-04-03 01:43:02 +00:00
test_sparse_command.rs tests: port test_sparse_command.rs to TestWorkDir API 2025-04-03 01:43:02 +00:00
test_split_command.rs config: migrate ui.default-description to template alias 2025-04-21 14:39:47 +00:00
test_squash_command.rs squash: don't add trailers to an empty description 2025-04-19 16:25:03 +00:00
test_status_command.rs tests: port test_status_command.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00
test_tag_command.rs tests: port test_tag_command.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00
test_templater.rs tests: port test_templater.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00
test_undo.rs tests: port test_undo.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00
test_util_command.rs config-schema: fix a typo in the $comment field 2025-04-24 15:48:08 +00:00
test_working_copy.rs tests: port test_working_copy.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00
test_workspaces.rs tests: port test_workspaces.rs to TestWorkDir API 2025-04-04 01:48:39 +00:00