aboutsummaryrefslogtreecommitdiff
path: root/cc/tests/cc_env.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-12-10 21:02:04 -0800
committerDaniel Mueller <deso@posteo.net>2018-12-10 21:02:04 -0800
commit8898de1f97aff9965e1518ca5abb554275183a14 (patch)
treeac7deb92599ec56d67432766b2cf4cd63388833a /cc/tests/cc_env.rs
parente2604a756aaddcd5919ee2f1b9cc0055d200f846 (diff)
downloadnitrocli-8898de1f97aff9965e1518ca5abb554275183a14.tar.gz
nitrocli-8898de1f97aff9965e1518ca5abb554275183a14.tar.bz2
Update cc crate to 1.0.25
This change updates the cc crate to version 1.0.25. Import subrepo cc/:cc at fe0a7acb6d3e22e03bf83bcbf89367be888b5448
Diffstat (limited to 'cc/tests/cc_env.rs')
-rw-r--r--cc/tests/cc_env.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/cc/tests/cc_env.rs b/cc/tests/cc_env.rs
index 8ffe651..f9386d7 100644
--- a/cc/tests/cc_env.rs
+++ b/cc/tests/cc_env.rs
@@ -14,6 +14,10 @@ fn main() {
distcc();
ccache_spaces();
ccache_env_flags();
+ leading_spaces();
+ extra_flags();
+ path_to_ccache();
+ more_spaces();
}
fn ccache() {
@@ -71,3 +75,45 @@ fn ccache_env_flags() {
env::set_var("CC", "");
}
+
+fn leading_spaces() {
+ let test = Test::gnu();
+ test.shim("ccache");
+
+ env::set_var("CC", " test ");
+ let compiler = test.gcc().file("foo.c").get_compiler();
+ assert_eq!(compiler.path(), Path::new("test"));
+
+ env::set_var("CC", "");
+}
+
+fn extra_flags() {
+ let test = Test::gnu();
+ test.shim("ccache");
+
+ env::set_var("CC", "ccache cc -m32");
+ let compiler = test.gcc().file("foo.c").get_compiler();
+ assert_eq!(compiler.path(), Path::new("cc"));
+}
+
+fn path_to_ccache() {
+ let test = Test::gnu();
+ test.shim("ccache");
+
+ env::set_var("CC", "/path/to/ccache.exe cc -m32");
+ let compiler = test.gcc().file("foo.c").get_compiler();
+ assert_eq!(compiler.path(), Path::new("cc"));
+ assert_eq!(
+ compiler.cc_env(),
+ OsString::from("/path/to/ccache.exe cc -m32"),
+ );
+}
+
+fn more_spaces() {
+ let test = Test::gnu();
+ test.shim("ccache");
+
+ env::set_var("CC", "cc -m32");
+ let compiler = test.gcc().file("foo.c").get_compiler();
+ assert_eq!(compiler.path(), Path::new("cc"));
+}