Skip to content

Commit 61eb46a

Browse files
committed
Test --web-bundle overrides for v1 & v2 CLI
1 parent 6632cb3 commit 61eb46a

1 file changed

Lines changed: 107 additions & 3 deletions

File tree

tests/executable.rs

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,9 @@ fn stdin_content() {
636636
success_or_panic(&output);
637637
}
638638

639+
/// Test various web bundle overrides for the v1 CLI & `-X compile`
639640
#[test]
640-
fn web_bundle_flag() {
641+
fn web_bundle_overrides() {
641642
let filename = "subdirectory/content/1.tex";
642643
let fmt_arg: &str = &get_plain_format_arg();
643644
let tempdir = setup_and_copy_files(&[filename]);
@@ -653,20 +654,123 @@ fn web_bundle_flag() {
653654
);
654655
error_or_panic(&output);
655656

656-
// test with a good bundle
657-
let valid_args: Vec<Vec<&str>> = vec![
657+
// test with a good bundle (override)
658+
let mut valid_args: Vec<Vec<&str>> = vec![
658659
// different positions
659660
[&arg_good_bundle[..], &[fmt_arg, filename]].concat(),
660661
[&[fmt_arg], &arg_good_bundle[..], &[filename]].concat(),
661662
[&[fmt_arg], &[filename], &arg_good_bundle[..]].concat(),
663+
// overriding vendor presets
664+
[
665+
&arg_bad_bundle[..],
666+
&arg_good_bundle[..],
667+
&[fmt_arg],
668+
&[filename],
669+
]
670+
.concat(),
671+
// stress test
672+
[
673+
&arg_bad_bundle[..],
674+
&arg_bad_bundle[..],
675+
&[fmt_arg],
676+
&arg_bad_bundle[..],
677+
&arg_bad_bundle[..],
678+
&[filename],
679+
&arg_bad_bundle[..],
680+
&arg_good_bundle[..],
681+
]
682+
.concat(),
662683
];
663684

685+
// test `-X compile`
686+
#[cfg(feature = "serialization")]
687+
valid_args.push(
688+
[
689+
&arg_bad_bundle[..],
690+
&arg_bad_bundle[..],
691+
&["-X"],
692+
&arg_bad_bundle[..],
693+
&["compile"],
694+
&arg_bad_bundle[..],
695+
&[fmt_arg],
696+
&arg_bad_bundle[..],
697+
&[filename],
698+
&arg_bad_bundle[..],
699+
&arg_good_bundle[..],
700+
]
701+
.concat(),
702+
);
703+
664704
for args in valid_args {
665705
let output = run_tectonic(&temppath, &args);
666706
success_or_panic(&output);
667707
}
668708
}
669709

710+
/// Test various web bundle overrides for the v2 CLI
711+
#[cfg(feature = "serialization")]
712+
#[test]
713+
fn v2_bundle_overrides() {
714+
let arg_bad_bundle = ["--web-bundle", "bad-bundle"];
715+
let arg_good_bundle = ["--web-bundle", "test-bundle://"];
716+
717+
// test `-X command`
718+
for command in ["new", "init"] {
719+
// test with a bad bundle
720+
let tempdir = setup_and_copy_files(&[]);
721+
let temppath = tempdir.path().to_owned();
722+
let output = run_tectonic(&temppath, &[&arg_bad_bundle[..], &["-X", command]].concat());
723+
error_or_panic(&output);
724+
725+
// test with a good bundle (override)
726+
let valid_args: Vec<Vec<&str>> = vec![
727+
// different positions
728+
[&arg_good_bundle[..], &["-X", command]].concat(),
729+
[&["-X"], &arg_good_bundle[..], &[command]].concat(),
730+
[&["-X", command], &arg_good_bundle[..]].concat(),
731+
// overriding vendor presets
732+
[&arg_bad_bundle[..], &arg_good_bundle[..], &["-X", command]].concat(),
733+
[
734+
&arg_bad_bundle[..],
735+
&["-X"],
736+
&arg_good_bundle[..],
737+
&[command],
738+
]
739+
.concat(),
740+
[&arg_bad_bundle[..], &["-X", command], &arg_good_bundle[..]].concat(),
741+
// stress test
742+
[
743+
&arg_bad_bundle[..],
744+
&arg_bad_bundle[..],
745+
&["-X"],
746+
&arg_bad_bundle[..],
747+
&arg_bad_bundle[..],
748+
&[command],
749+
&arg_bad_bundle[..],
750+
&arg_good_bundle[..],
751+
]
752+
.concat(),
753+
];
754+
755+
for args in valid_args {
756+
let tempdir = setup_and_copy_files(&[]);
757+
let temppath = tempdir.path().to_owned();
758+
let output = run_tectonic(&temppath, &args);
759+
success_or_panic(&output);
760+
}
761+
}
762+
763+
// test `-X build`
764+
let (_tempdir, temppath) = setup_v2();
765+
766+
// `--web-bundle` is ignored
767+
let output = run_tectonic(
768+
&temppath,
769+
&[&arg_bad_bundle[..], &["-X"], &["build"]].concat(),
770+
);
771+
success_or_panic(&output);
772+
}
773+
670774
#[cfg(feature = "serialization")]
671775
#[test]
672776
fn v2_build_basic() {

0 commit comments

Comments
 (0)