Skip to content

Commit ae37885

Browse files
committed
Test that ui tests actually work
also exposes where it's noisy and hard to actually ui test a crate itself
1 parent 0323f4e commit ae37885

File tree

11 files changed

+709
-0
lines changed

11 files changed

+709
-0
lines changed

src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ pub struct Config {
5555
pub quiet: bool,
5656
}
5757

58+
impl Default for Config {
59+
fn default() -> Self {
60+
Self {
61+
args: vec![],
62+
target: None,
63+
stderr_filters: vec![],
64+
stdout_filters: vec![],
65+
root_dir: PathBuf::new(),
66+
mode: Mode::Fail,
67+
program: PathBuf::from("rustc"),
68+
output_conflict_handling: OutputConflictHandling::Error,
69+
path_filter: vec![],
70+
dependencies_crate_manifest_path: None,
71+
dependency_builder: None,
72+
quiet: true,
73+
}
74+
}
75+
}
76+
5877
#[derive(Debug)]
5978
pub struct DependencyBuilder {
6079
pub program: PathBuf,

tests/integration.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[test]
2+
fn integrations() {
3+
run("basic");
4+
}
5+
6+
fn run(name: &str) {
7+
let path = std::path::Path::new(file!()).parent().unwrap();
8+
9+
let mut cmd = std::process::Command::new(std::env::var_os("CARGO").unwrap());
10+
cmd.arg("test");
11+
12+
cmd.arg("--target-dir");
13+
cmd.arg(path.parent().unwrap().join("target"));
14+
15+
cmd.arg("--manifest-path");
16+
cmd.arg(format!("{}/integrations/{name}/Cargo.toml", path.display()));
17+
18+
assert!(cmd.status().unwrap().success());
19+
}

0 commit comments

Comments
 (0)