refactored: test style cleanup + mmc archive extract test

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.
This commit is contained in:
objz committed 2026-05-27 17:09:09 +02:00
1 parent 623acd9e2c
commit 1f1a0ebb3d
8 files changed
+173 -185

No files matched your search

+1 -1
View File
@@ -95,7 +95,7 @@ pub async fn handle_import(matches: &ArgMatches) -> CliResult {
}
println!(
"Importing '{}' — {} {} ({} mods, {} overrides)",
"Importing '{}' - {} {} ({} mods, {} overrides)",
summary.name,
summary.game_version,
summary.loader,