build(rust): vendor googletest crate
This commit was merged in pull request #76.
This commit is contained in:
21
third_party/crates/autocfg-1.5.1/tests/support/mod.rs
vendored
Normal file
21
third_party/crates/autocfg-1.5.1/tests/support/mod.rs
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// The directory containing this test binary.
|
||||
pub fn exe_dir() -> PathBuf {
|
||||
let exe = env::current_exe().unwrap();
|
||||
exe.parent().unwrap().to_path_buf()
|
||||
}
|
||||
|
||||
/// The directory to use for test probes.
|
||||
pub fn out_dir() -> Cow<'static, Path> {
|
||||
if let Some(tmpdir) = option_env!("CARGO_TARGET_TMPDIR") {
|
||||
Cow::Borrowed(tmpdir.as_ref())
|
||||
} else if let Some(tmpdir) = env::var_os("TESTS_TARGET_DIR") {
|
||||
Cow::Owned(tmpdir.into())
|
||||
} else {
|
||||
// Use the same path as this test binary.
|
||||
Cow::Owned(exe_dir())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user