mirror of
https://github.com/storytold/soundcraft.git
synced 2026-12-02 20:22:27 -05:00
test(nightly): preserve startup and saved session coverage (#1950)
This commit is contained in:
1 parent
40497d7eca
commit
7b4905c00e
1 file changed
+26
-12
@@ -201,14 +201,18 @@ mod tests {
|
|||||||
let plain = parse_startup(BuildFlavor::NightlyV1, &spec, args(&[flag]), &StartupOptions::new()).unwrap();
|
let plain = parse_startup(BuildFlavor::NightlyV1, &spec, args(&[flag]), &StartupOptions::new()).unwrap();
|
||||||
assert!(plain.is_version_query());
|
assert!(plain.is_version_query());
|
||||||
|
|
||||||
let launcher = parse_startup(
|
for header in [
|
||||||
BuildFlavor::NightlyV1,
|
["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute()],
|
||||||
&spec,
|
["--profile-root", absolute(), "--launch-profile", NIGHTLY_V1_CONTRACT],
|
||||||
args(&["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute(), flag]),
|
] {
|
||||||
&StartupOptions::new(),
|
let mut query = args(&header);
|
||||||
)
|
query.push(flag.into());
|
||||||
.unwrap();
|
assert!(parse_startup(BuildFlavor::NightlyV1, &spec, query.clone(), &StartupOptions::new()).unwrap().is_version_query());
|
||||||
assert!(launcher.is_version_query());
|
query.push("recording with spaces.wav".into());
|
||||||
|
let launch = parse_startup(BuildFlavor::NightlyV1, &spec, query, &StartupOptions::new()).unwrap();
|
||||||
|
assert!(!launch.is_version_query());
|
||||||
|
assert_eq!(launch.passthrough_args, args(&[flag, "recording with spaces.wav"]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,10 +233,20 @@ mod tests {
|
|||||||
}
|
}
|
||||||
assert_eq!(validate_and_prepare_root(&root, &spec).unwrap(), prepared);
|
assert_eq!(validate_and_prepare_root(&root, &spec).unwrap(), prepared);
|
||||||
|
|
||||||
let autosave = prepared.join("Autosave");
|
for file in ["ui.json", "nightly-session.lock", "nightly-session.json"] {
|
||||||
std::fs::remove_dir(&autosave).unwrap();
|
assert_eq!(std::fs::read(prepared.join(file)).unwrap(), b"saved profile data", "{file} remains intact after reopen");
|
||||||
std::fs::write(&autosave, b"not a directory").unwrap();
|
}
|
||||||
assert!(matches!(validate_and_prepare_root(&root, &spec), Err(ProfileError::ExpectedDirectoryEntry(_))));
|
for folder in FOLDER_ONLY_ENTRIES {
|
||||||
|
let path = prepared.join(folder);
|
||||||
|
std::fs::remove_dir(&path).unwrap();
|
||||||
|
std::fs::write(&path, b"not a directory").unwrap();
|
||||||
|
assert!(
|
||||||
|
matches!(validate_and_prepare_root(&root, &spec), Err(ProfileError::ExpectedDirectoryEntry(_))),
|
||||||
|
"{folder} must remain a directory"
|
||||||
|
);
|
||||||
|
std::fs::remove_file(&path).unwrap();
|
||||||
|
std::fs::create_dir(&path).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in new issue
Block a user