jj/cli/tests
Austin Seipp ddfdf5e357 cli: allow snapshot.max-new-file-size to be a raw u64
Previously, this command would work:

    jj --config-toml='snapshot.max-new-file-size="1"' st

And is equivalent to this:

    jj --config-toml='snapshot.max-new-file-size="1B"' st

But this would not work, despite looking like it should:

    jj --config-toml='snapshot.max-new-file-size=1' st

This is extremely confusing for users.

This config value is deserialized via serde; and while the `HumanByteSize`
struct allegedly implemented Serde's `visit_u64` method, it was not called by
the deserialize visitor. Strangely, adding an `visit_i64` method *did* work, but
then requires handling of overflow, etc. This is likely because TOML integers
are naturally specified in `i64`.

Instead, just don't bother with any of that; implement a `TryFrom<String>`
instance for `HumanByteSize` that uses `u64::from_str` to try parsing the string
immediately; *then* fall back to `parse_human_byte_size` if that doesn't work.
This not only fixes the behavior but, IMO, is much simpler to reason about; we
get our `Deserialize` instance for free from the `TryFrom` instance.

Finally, this adjusts the test for `max-new-file-size` to now use a raw integer
literal, to ensure it doesn't regress. (There are already in-crate tests for
parsing the human readable strings.)

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I8dafa2358d039ad1c07e9a512c1d10fed5845738
2024-04-19 13:03:24 -05:00
..
common
cli-reference@.md.snap parallelize: make the command pass in more cases 2024-04-18 21:06:52 -07:00
runner.rs
test_abandon_command.rs
test_alias.rs
test_branch_command.rs
test_builtin_aliases.rs
test_cat_command.rs cli: migrate "cat" to matcher API, warn unmatched paths 2024-04-16 10:12:31 +09:00
test_checkout.rs
test_chmod_command.rs cli: migrate "chmod" to matcher API, warn unmatched paths 2024-04-11 00:51:19 +09:00
test_commit_command.rs
test_commit_template.rs
test_concurrent_operations.rs
test_config_command.rs
test_debug_command.rs cli: add fileset utility functions and debug command 2024-04-09 20:42:09 +09:00
test_describe_command.rs
test_diff_command.rs fileset: parse cwd/root-glob patterns 2024-04-18 11:09:54 +09:00
test_diffedit_command.rs
test_duplicate_command.rs
test_edit_command.rs
test_generate_md_cli_help.rs
test_git_clone.rs
test_git_colocated.rs
test_git_fetch.rs
test_git_import_export.rs
test_git_init.rs
test_git_push.rs
test_git_remotes.rs
test_git_submodule.rs
test_gitignores.rs
test_global_opts.rs cli: suggest root:"<path>" if cwd-relative path is not in workspace 2024-04-19 09:35:47 +09:00
test_immutable_commits.rs
test_init_command.rs
test_interdiff_command.rs
test_log_command.rs Add template aliases with node symbol configs. 2024-04-15 22:21:31 +02:00
test_move_command.rs
test_new_command.rs
test_next_prev_commands.rs
test_obslog_command.rs Add template aliases with node symbol configs. 2024-04-15 22:21:31 +02:00
test_operations.rs Add template aliases with node symbol configs. 2024-04-15 22:21:31 +02:00
test_parallelize_command.rs parallelize: make the command pass in more cases 2024-04-18 21:06:52 -07:00
test_rebase_command.rs
test_repo_change_report.rs
test_resolve_command.rs
test_restore_command.rs
test_revset_output.rs
test_root.rs
test_shell_completion.rs
test_show_command.rs Add template aliases with node symbol configs. 2024-04-15 22:21:31 +02:00
test_sparse_command.rs
test_split_command.rs Add a test for splitting the parent of a merge commit without --siblings 2024-04-11 14:58:55 -04:00
test_squash_command.rs Add a --use-destination-message option to jj squash 2024-04-14 16:58:30 -04:00
test_status_command.rs
test_tag_command.rs
test_templater.rs cli: label log/obslog template as "log" 2024-04-18 11:14:28 +09:00
test_tree_level_conflicts.rs
test_undo.rs
test_unsquash_command.rs
test_untrack_command.rs
test_util_command.rs
test_working_copy.rs cli: allow snapshot.max-new-file-size to be a raw u64 2024-04-19 13:03:24 -05:00
test_workspaces.rs