Picks up the style audit's findings without touching production
behaviour (except for two em-dash characters in non-test code that
violated the no-em-dash rule).
- cli/import.rs, instance/import/mmc.rs: replace the two em-dashes
that leaked into source (one in a user-facing format string, one
in a code comment) with hyphen / colon.
- instance/manager.rs: rewrite test_manager to return TempDir instead
of a hand-rolled tempdir path with manual cleanup. Drop the
trailing std::fs::remove_dir_all from every test. Rename test_*
functions to describe the scenario per CONTRIBUTING (delete_missing_
instance_returns_not_found, save_then_load_all_round_trips_config,
load_one_missing_returns_not_found, etc.).
- migrate.rs: replace unique_tmp + atomic counter with
tempfile::tempdir() across all seven tests; ~10 lines of plumbing
gone, automatic cleanup via Drop.
- auth/accounts.rs: drop the dummy_account wrapper that just forwarded
to create_offline_account; inline the real call at the eight use
sites.
- instance/models.rs: rename test_instance_config_roundtrip to
instance_config_roundtrips_through_json.
- instance/content/mods.rs: drop the "what" comments above straight
forward asserts; keep the one "why" comment that explains an
empty-name + present-logo coverage gap. Trim the obvious "helper to
create a jar (zip) file" comment above make_jar.
- tests/smoke.rs: //! to // for the file header; project convention is
// for files (//! is for crate-level rustdoc, which doesn't render
for integration test crates).
Adds one new test:
- instance/import/mmc.rs: extract_mmc_archive_copies_minecraft_subtree
builds an in-memory zip with a Pack/ prefix, a Pack/mmc-pack.json
sibling, and Pack/.minecraft/{options.txt, mods/test-mod.jar},
then asserts only the .minecraft/ subtree lands in the destination
with relative paths preserved. Closes the mmc extract coverage gap
the audit flagged.
Audit identified six high-priority coverage gaps. This commit closes
them with 30 net new passing tests.
- tests/net_retry.rs (new): 5 wiremock-based tests for the retry
envelope in net/mod.rs. Covers get_json + download_file across:
5xx retry-then-succeed, 4xx fail-fast (asserted via wiremock
expect(1) so any retry attempt fails the test), and exhaust at
MAX_RETRIES = 3 (asserted via expect(4)). The exhaust test takes
~3.5s of wall time because the production code sleeps 500 + 1000 +
2000 ms between attempts; this is unavoidable without making the
delays configurable.
- tests/launch_pipeline.rs: 3 new error-path tests against
build_launch_invocation. merged_profile_missing_main_class_fails
surfaces the LaunchError::Parse branch when meta.json deserialises
cleanly but lacks mainClass. legacy_loader_profile_missing_loader_version_errors
and legacy_loader_profile_missing_installer_json_errors exercise the
two Parse branches inside migrate_legacy_loader_profile_if_needed.
- instance/manager.rs: 6 tests for rename (happy path, noop on same
name, empty target rejected, missing source, target collision) and
touch_last_played (sets the field to a stamp within 5 seconds of
now). The InstanceManager rename surface had no coverage before;
mutating the validation order or the std::fs::rename target would
not have failed any existing test.
- instance/content/mods.rs: 4 new precedence-chain tests. The reader
chain is fabric > quilt > forge-toml (which itself tries
neoforge.mods.toml before mods.toml) > mcmod.info. Only the
fabric-over-forge precedence had a test before. Adds quilt > forge,
forge_toml > mcmod_info, neoforge.mods.toml > mods.toml, and a test
that a mods.toml carrying only logoFile (no [[mods]] array) still
resolves the icon.
- tui/widgets/instances.rs: 12 new tests for format_last_played. One
case for the None input (returns "Never played"), then an rstest
covering each bucket boundary in the match (0/59 just-now,
60/3599 minutes, 3600/86399 hours, 86400/2591999 days,
2592000/31535999 months, >=31536000 over-a-year). A mutation that
bumps any boundary by one second, or swaps a unit suffix, fails at
least one case.
vanilla launches now read upstream mojang JSON via the new LaunchProfile
path, render game/JVM args through launch_profile::render with template
substitution, and store the cached meta.json byte-for-byte instead of
re-serializing through a narrow struct. legacy stripped meta.json files
are re-fetched on first launch. adds HttpClient::get_bytes and
fetch_version_meta_with_raw; collapses the two library-rule evaluators
into one shared launch_profile::rules::evaluate.
Renames Cargo package, binary, internal path identifiers, java shim,
user-agent, log filename, desktop shortcut Exec lines, and CLI program
name. Wires src/migrate.rs into main() so existing users have their
on-disk data (~/.config/mcl/, ~/.local/share/mcl/, ~/.cache/mcl/) moved
to the new locations on first launch.
BREAKING CHANGE: binary is now named rmcl. Old paths are auto-migrated.