Skip to content

Commit

Permalink
Test C and C++ compilation explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Nov 24, 2020
1 parent dba7836 commit ff570c3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ cc_binary(
srcs = ["cc-test.cc"],
)

cc_binary(
name = "c-test",
srcs = ["c-test.c"],
)

# Test that nixpkgs_cc_configure is selected.
cc_toolchain_test(
name = "cc-toolchain",
Expand Down
7 changes: 7 additions & 0 deletions tests/c-test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "stdio.h"
int main() {
puts("Hello world\n");
// Ensure that this is compiled as C, template is a keyword in C++.
int template = 0;
return template;
}
6 changes: 5 additions & 1 deletion tests/cc-test.cc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
int main() { return 0; }
#include <iostream>
int main() {
std::cout << "Hello world\n";
return 0;
}

0 comments on commit ff570c3

Please sign in to comment.