Skip to content

Commit

Permalink
Add unit test for clang::is_minversion
Browse files Browse the repository at this point in the history
  • Loading branch information
grembo committed Sep 4, 2023
1 parent 4463aa4 commit 5ee7c72
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/compiler/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,36 @@ mod test {
}
}

#[test]
fn test_is_minversion() {
assert_eq!(Clang {
clangplusplus: false,
is_appleclang: false,
version: Some("\"Ubuntu Clang 14.0.0\"".to_string()),
}.is_minversion(14), true);
assert_eq!(Clang {
clangplusplus: false,
is_appleclang: false,
version: Some("\"Ubuntu Clang 13.0.0\"".to_string()),
}.is_minversion(14), false);
assert_eq!(Clang {
clangplusplus: false,
is_appleclang: false,
version: Some("\"FreeBSD Clang 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)\"".to_string()),
}.is_minversion(14), true);
assert_eq!(Clang {
clangplusplus: false,
is_appleclang: false,
version: Some("\"FreeBSD Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)\"".to_string()),
}.is_minversion(14), false);

assert_eq!(Clang {
clangplusplus: false,
is_appleclang: true,
version: Some("\"FreeBSD Clang 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)\"".to_string()),
}.is_minversion(14), false); // is_appleclang wins
}

#[test]
fn test_parse_arguments_simple() {
let a = parses!("-c", "foo.c", "-o", "foo.o");
Expand Down

0 comments on commit 5ee7c72

Please sign in to comment.