aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c0286f8..fc81e42 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -448,3 +448,38 @@ fn path_segment_for_trait(sometrait: &ItemTrait) -> PathSegment {
#[doc = include_str!("../tests/doctests.md")]
#[cfg(doctest)]
struct Doctests;
+
+#[test]
+fn ui() {
+ use std::process::Command;
+
+ for entry in std::fs::read_dir("ui-tests/src/bin").unwrap().flatten() {
+ if entry.path().extension().unwrap() == "rs" {
+ let output = Command::new("cargo")
+ .arg("check")
+ .arg("--quiet")
+ .arg("--bin")
+ .arg(entry.path().file_stem().unwrap())
+ .current_dir("ui-tests")
+ .output()
+ .unwrap();
+ let received_stderr = std::str::from_utf8(&output.stderr)
+ .unwrap()
+ .lines()
+ .filter(|l| !l.starts_with("error: could not compile"))
+ .collect::<Vec<_>>()
+ .join("\n");
+ let expected_stderr =
+ std::fs::read_to_string(entry.path().with_extension("stderr")).unwrap_or_default();
+ if received_stderr != expected_stderr {
+ println!(
+ "EXPECTED:\n{banner}\n{expected}{banner}\n\nACTUAL OUTPUT:\n{banner}\n{actual}{banner}",
+ banner = "-".repeat(30),
+ expected = expected_stderr,
+ actual = received_stderr
+ );
+ panic!("failed");
+ }
+ }
+ }
+}