summaryrefslogtreecommitdiffstats
path: root/vendor/escargot/tests/build.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /vendor/escargot/tests/build.rs
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-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.rs69
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());
+}