summaryrefslogtreecommitdiff
path: root/cc/tests/cc_env.rs
diff options
context:
space:
mode:
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"));
+}