mirror of https://github.com/rust-lang/rust.git
Add `run-make-support::rust_lib_name`
This commit is contained in:
parent
de1d0e0da9
commit
301d7229f7
|
@ -135,7 +135,13 @@ pub fn dynamic_lib_name(name: &str) -> String {
|
|||
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
|
||||
/// path with `$TMPDIR` joined with the library name.
|
||||
pub fn rust_lib(name: &str) -> PathBuf {
|
||||
tmp_dir().join(format!("lib{name}.rlib"))
|
||||
tmp_dir().join(rust_lib_name(name))
|
||||
}
|
||||
|
||||
/// Generate the name a rust library (rlib) would have. If you want the complete path, use
|
||||
/// [`rust_lib`] instead.
|
||||
pub fn rust_lib_name(name: &str) -> String {
|
||||
format!("lib{name}.rlib")
|
||||
}
|
||||
|
||||
/// Construct the binary name based on platform.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::process::Output;
|
||||
|
||||
use run_make_support::{bin_name, rust_lib, rustc};
|
||||
use run_make_support::{bin_name, rust_lib_name, rustc};
|
||||
|
||||
fn compare_stdout<S: AsRef<str>>(output: Output, expected: S) {
|
||||
assert_eq!(
|
||||
|
@ -34,10 +34,10 @@ fn main() {
|
|||
);
|
||||
compare_stdout(
|
||||
rustc().print("file-names").input("lib.rs").run(),
|
||||
rust_lib("mylib").file_name().unwrap().to_string_lossy(),
|
||||
rust_lib_name("mylib"),
|
||||
);
|
||||
compare_stdout(
|
||||
rustc().print("file-names").input("rlib.rs").run(),
|
||||
rust_lib("mylib").file_name().unwrap().to_string_lossy(),
|
||||
rust_lib_name("mylib"),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue