diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:24 +0000 |
commit | 023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch) | |
tree | 60fc59477c605c72b0a1051409062ddecc43f877 /vendor/escargot/tests/build.rs | |
parent | Adding debian version 1.72.1+dfsg1-1. (diff) | |
download | rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/escargot/tests/build.rs')
-rw-r--r-- | vendor/escargot/tests/build.rs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/vendor/escargot/tests/build.rs b/vendor/escargot/tests/build.rs new file mode 100644 index 000000000..d5e03a22a --- /dev/null +++ b/vendor/escargot/tests/build.rs @@ -0,0 +1,69 @@ +fn test_fixture(name: &str) { + let temp = assert_fs::TempDir::new().unwrap(); + + let msgs = escargot::CargoBuild::new() + .manifest_path(format!("tests/fixtures/{}/Cargo.toml", name)) + .current_release() + .current_target() + .target_dir(temp.path()) + .exec() + .unwrap(); + for msg in msgs { + let raw_msg = msg.unwrap(); + let msg = raw_msg.decode(); + match msg { + Ok(msg) => println!("{:#?}", msg), + Err(err) => panic!("{}\nmsg=`{:#?}`", err, raw_msg), + } + } +} + +#[test] +fn test_bin() { + test_fixture("bin"); +} + +#[test] +fn test_lib() { + test_fixture("lib"); +} + +#[test] +fn test_bin_lib() { + test_fixture("bin_lib"); +} + +#[test] +fn test_warn() { + test_fixture("warn"); +} + +#[test] +fn test_build_script() { + test_fixture("script"); +} + +#[test] +fn test_dependency() { + test_fixture("dep"); +} + +#[test] +fn test_error() { + let msgs: Vec<_> = escargot::CargoBuild::new() + .manifest_path("tests/fixtures/error/Cargo.toml") + .current_release() + .current_target() + .exec() + .unwrap() + .collect(); + assert!(1 < msgs.len()); + let error_idx = msgs.len() - 1; + for msg in &msgs[0..error_idx] { + let msg = msg.as_ref().unwrap(); + let msg = msg.decode().unwrap(); + println!("{:#?}", msg); + } + assert!(msgs[error_idx].is_err()); + println!("```{}```", msgs[error_idx].as_ref().err().unwrap()); +} |