Skip to content

Commit

Permalink
Test the --web-bundle options for the v2 CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
bryango committed Dec 22, 2023
1 parent 02f1f13 commit 4404d97
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions tests/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<&str>> = 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() {
Expand Down

0 comments on commit 4404d97

Please sign in to comment.