max / makeover
1 file changed,
+29 insertions,
-0 deletions
| @@ -481,6 +481,35 @@ primary = "#ff0000" | |||
| 481 | 481 | } | |
| 482 | 482 | ||
| 483 | 483 | #[test] | |
| 484 | + | fn dev_themes_dir_returns_some_when_structure_exists() { | |
| 485 | + | // Construct a fake tree: <tmp>/leaf where <tmp>/MNW/shared/themes exists. | |
| 486 | + | // Walking up 1 level from `leaf` should locate the themes dir. | |
| 487 | + | // Catches `dev_themes_dir -> Option<PathBuf> with None` (always-None mutant). | |
| 488 | + | let root = tempfile::tempdir().unwrap(); | |
| 489 | + | let leaf = root.path().join("leaf"); | |
| 490 | + | std::fs::create_dir_all(&leaf).unwrap(); | |
| 491 | + | let themes = root.path().join("MNW").join("shared").join("themes"); | |
| 492 | + | std::fs::create_dir_all(&themes).unwrap(); | |
| 493 | + | ||
| 494 | + | let result = dev_themes_dir(&leaf, 1); | |
| 495 | + | // Compare canonical forms — tempfile may return paths with /private prefix on macOS. | |
| 496 | + | let result_canon = result.expect("expected Some").canonicalize().unwrap(); | |
| 497 | + | let themes_canon = themes.canonicalize().unwrap(); | |
| 498 | + | assert_eq!(result_canon, themes_canon); | |
| 499 | + | } | |
| 500 | + | ||
| 501 | + | #[test] | |
| 502 | + | fn dev_themes_dir_returns_none_when_structure_missing() { | |
| 503 | + | // No MNW/shared/themes under the temp root → None. | |
| 504 | + | let root = tempfile::tempdir().unwrap(); | |
| 505 | + | let leaf = root.path().join("leaf"); | |
| 506 | + | std::fs::create_dir_all(&leaf).unwrap(); | |
| 507 | + | // No themes dir created. | |
| 508 | + | let result = dev_themes_dir(&leaf, 1); | |
| 509 | + | assert!(result.is_none()); | |
| 510 | + | } | |
| 511 | + | ||
| 512 | + | #[test] | |
| 484 | 513 | fn import_theme_valid() { | |
| 485 | 514 | let src_dir = tempfile::tempdir().unwrap(); | |
| 486 | 515 | let custom_dir = tempfile::tempdir().unwrap(); |