diff --git a/tests/executable.rs b/tests/executable.rs index 6c824ef31..4391fb721 100644 --- a/tests/executable.rs +++ b/tests/executable.rs @@ -737,6 +737,69 @@ fn v2_build_multiple_outputs() { success_or_panic(&output); } +/// Test various web bundle overrides for the v2 CLI +#[cfg(feature = "serialization")] +#[test] +fn v2_bundle_overrides() { + let arg_bad_bundle = ["--web-bundle", "overriden"]; + let arg_good_bundle = ["--web-bundle", "test-bundle://"]; + + // test `-X new` with a bad bundle + let tempdir = setup_and_copy_files(&[]); + let temppath = tempdir.path().to_owned(); + let output = run_tectonic(&temppath, &[&arg_bad_bundle[..], &["-X", "new"]].concat()); + error_or_panic(&output); + + // test `-X new` + let valid_args: Vec> = vec![ + // different positions + [&arg_good_bundle[..], &["-X", "new"]].concat(), + [&["-X"], &arg_good_bundle[..], &["new"]].concat(), + [&["-X", "new"], &arg_good_bundle[..]].concat(), + // overriding vendor presets + [&arg_bad_bundle[..], &arg_good_bundle[..], &["-X", "new"]].concat(), + [&arg_bad_bundle[..], &["-X"], &arg_good_bundle[..], &["new"]].concat(), + [&arg_bad_bundle[..], &["-X", "new"], &arg_good_bundle[..]].concat(), + // stress test + [ + &arg_bad_bundle[..], + &arg_bad_bundle[..], + &["-X"], + &arg_bad_bundle[..], + &arg_bad_bundle[..], + &["new"], + &arg_bad_bundle[..], + &arg_good_bundle[..], + ] + .concat(), + ]; + + for args in valid_args { + let tempdir = setup_and_copy_files(&[]); + let temppath = tempdir.path().to_owned(); + let output = run_tectonic(&temppath, &args); + success_or_panic(&output); + } + + // test `-X build` + let (_tempdir, temppath) = setup_v2(); + let output = run_tectonic( + &temppath, + &[ + &arg_bad_bundle[..], + &arg_bad_bundle[..], + &["-X"], + &arg_bad_bundle[..], + &arg_bad_bundle[..], + &["build"], + &arg_bad_bundle[..], + &arg_good_bundle[..], + ] + .concat(), + ); + success_or_panic(&output); +} + #[test] #[cfg(feature = "serialization")] fn v2_dump_basic() {