os-rust/tests/run-make/crate-loading/rmake.rs
Esteban Küber bee5d0996b Move the crate-loading test to use diff output
(cherry picked from commit 998ff2f0cd)
2025-01-02 14:28:32 -08:00

38 lines
1.1 KiB
Rust

//@ only-linux
//@ ignore-wasm32
//@ ignore-wasm64
// ignore-tidy-linelength
use run_make_support::{diff, rust_lib_name, rustc};
fn main() {
rustc().input("multiple-dep-versions-1.rs").run();
rustc().input("multiple-dep-versions-2.rs").extra_filename("2").metadata("2").run();
rustc()
.input("multiple-dep-versions-3.rs")
.extern_("dependency", rust_lib_name("dependency2"))
.run();
let out = rustc()
.input("multiple-dep-versions.rs")
.extern_("dependency", rust_lib_name("dependency"))
.extern_("dep_2_reexport", rust_lib_name("foo"))
.ui_testing()
.run_fail()
.stderr_utf8();
// We don't remap all the paths, so we remap it here.
let mut lines: Vec<_> = out.lines().collect();
for line in &mut lines {
if line.starts_with(" --> ") {
*line = " --> replaced";
}
if line.starts_with(" ::: ") {
*line = " ::: replaced";
}
}
diff()
.expected_file("multiple-dep-versions.stderr")
.actual_text("(rustc)", &lines.join("\n"))
.run();
}