summaryrefslogtreecommitdiffstats
path: root/third_party/rust/pkg-config/tests/test.rs
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-13 13:38:57 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-03-13 13:38:57 +0100
commit38d185280e2cad4ed6673bb38f707f54dad4ded7 (patch)
treebbbb7df9a9f18c5fd3caf406d7f5bc9e13168d1f /third_party/rust/pkg-config/tests/test.rs
parent7c68c5a22cfe8f83322836a1a6a76a8ae0415ec1 (diff)
downloadUXP-38d185280e2cad4ed6673bb38f707f54dad4ded7.tar
UXP-38d185280e2cad4ed6673bb38f707f54dad4ded7.tar.gz
UXP-38d185280e2cad4ed6673bb38f707f54dad4ded7.tar.lz
UXP-38d185280e2cad4ed6673bb38f707f54dad4ded7.tar.xz
UXP-38d185280e2cad4ed6673bb38f707f54dad4ded7.zip
Remove Rust from the tree.
Part 4 for #58
Diffstat (limited to 'third_party/rust/pkg-config/tests/test.rs')
-rw-r--r--third_party/rust/pkg-config/tests/test.rs97
1 files changed, 0 insertions, 97 deletions
diff --git a/third_party/rust/pkg-config/tests/test.rs b/third_party/rust/pkg-config/tests/test.rs
deleted file mode 100644
index 842516690..000000000
--- a/third_party/rust/pkg-config/tests/test.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-#![feature(static_mutex)]
-
-extern crate pkg_config;
-
-use pkg_config::Error;
-use std::env;
-use std::sync::{StaticMutex, MUTEX_INIT};
-use std::path::PathBuf;
-
-static LOCK: StaticMutex = MUTEX_INIT;
-
-fn reset() {
- for (k, _) in env::vars() {
- if k.contains("DYNAMIC") ||
- k.contains("STATIC") ||
- k.contains("PKG_CONFIG_ALLOW_CROSS") ||
- k.contains("FOO_NO_PKG_CONFIG") {
- env::remove_var(&k);
- }
- }
- env::remove_var("TARGET");
- env::remove_var("HOST");
- env::set_var("PKG_CONFIG_PATH", &env::current_dir().unwrap().join("tests"));
-}
-
-fn find(name: &str) -> Result<pkg_config::Library, Error> {
- pkg_config::probe_library(name)
-}
-
-#[test]
-fn cross_disabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("TARGET", "foo");
- env::set_var("HOST", "bar");
- match find("foo") {
- Err(Error::CrossCompilation) => {},
- x => panic!("Error::CrossCompilation expected, found `{:?}`", x),
- }
-}
-
-#[test]
-fn cross_enabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("TARGET", "foo");
- env::set_var("HOST", "bar");
- env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
- find("foo").unwrap();
-}
-
-#[test]
-fn package_disabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("FOO_NO_PKG_CONFIG", "1");
- match find("foo") {
- Err(Error::EnvNoPkgConfig(name)) => {
- assert_eq!(name, "FOO_NO_PKG_CONFIG")
- }
- x => panic!("Error::EnvNoPkgConfig expected, found `{:?}`", x),
- }
-}
-
-#[test]
-fn output_ok() {
- let _g = LOCK.lock();
- reset();
- let lib = find("foo").unwrap();
- assert!(lib.libs.contains(&"gcc".to_string()));
- assert!(lib.libs.contains(&"coregrind-amd64-linux".to_string()));
- assert!(lib.link_paths.contains(&PathBuf::from("/usr/lib/valgrind")));
-}
-
-#[test]
-fn framework() {
- let _g = LOCK.lock();
- reset();
- let lib = find("framework").unwrap();
- assert!(lib.frameworks.contains(&"foo".to_string()));
- assert!(lib.framework_paths.contains(&PathBuf::from("/usr/lib")));
-}
-
-#[test]
-fn get_variable() {
- let _g = LOCK.lock();
- reset();
- let prefix = pkg_config::get_variable("foo", "prefix").unwrap();
- assert_eq!(prefix, "/usr");
-}
-
-#[test]
-fn version() {
- let _g = LOCK.lock();
- reset();
- assert_eq!(&find("foo").unwrap().version[..], "3.10.0.SVN");
-}