diff --git a/src/compiler/c.rs b/src/compiler/c.rs index 2badc6f71..be335d9a6 100644 --- a/src/compiler/c.rs +++ b/src/compiler/c.rs @@ -1448,6 +1448,42 @@ mod test { ); } + #[test] + fn test_header_differs() { + let args = ovec!["a", "b", "c"]; + const PREPROCESSED: &[u8] = b"hello world"; + assert_neq!( + hash_key("abcd", Language::C, &args, &[], &[], PREPROCESSED, false), + hash_key( + "abcd", + Language::CHeader, + &args, + &[], + &[], + PREPROCESSED, + false + ) + ); + } + + #[test] + fn test_plusplus_header_differs() { + let args = ovec!["a", "b", "c"]; + const PREPROCESSED: &[u8] = b"hello world"; + assert_neq!( + hash_key("abcd", Language::Cxx, &args, &[], &[], PREPROCESSED, true), + hash_key( + "abcd", + Language::CxxHeader, + &args, + &[], + &[], + PREPROCESSED, + true + ) + ); + } + #[test] fn test_hash_key_executable_contents_differs() { let args = ovec!["a", "b", "c"]; diff --git a/src/compiler/compiler.rs b/src/compiler/compiler.rs index a37d20775..812d34087 100644 --- a/src/compiler/compiler.rs +++ b/src/compiler/compiler.rs @@ -146,8 +146,10 @@ impl Language { pub fn as_str(self) -> &'static str { match self { - Language::C | Language::CHeader => "c", - Language::Cxx | Language::CxxHeader => "c++", + Language::C => "c", + Language::CHeader => "cHeader", + Language::Cxx => "c++", + Language::CxxHeader => "c++Header", Language::GenericHeader => "c/c++", Language::ObjectiveC => "objc", Language::ObjectiveCxx => "objc++",