-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
tests/cc/cpp_compile_error_defines_is_transitive
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
tests/cc/cpp_compile_error_defines_is_transitive/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
load("//lang/cc:defs.bzl", "cc_build_error") | ||
load("//matcher:defs.bzl", "matcher") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
|
||
cc_library( | ||
name = "library", | ||
defines = ["MACRO_IN_DEFINES"], | ||
) | ||
|
||
cc_build_error( | ||
name = "plain", | ||
src = "cpp_compile_error.cpp", | ||
deps = [":library"], | ||
) | ||
|
||
cc_build_error( | ||
name = "with_substr_matcher", | ||
src = "cpp_compile_error.cpp", | ||
compile_stderr = matcher.has_substr("With transitive defines, "), | ||
deps = [":library"], | ||
) | ||
|
||
cc_build_error( | ||
name = "with_basic_regex_matcher", | ||
src = "cpp_compile_error.cpp", | ||
compile_stderr = matcher.contains_basic_regex("With transitive defines, this.*"), | ||
deps = [":library"], | ||
) | ||
|
||
cc_build_error( | ||
name = "with_extended_regex_matcher", | ||
src = "cpp_compile_error.cpp", | ||
compile_stderr = matcher.contains_extended_regex("With transitive defines, this.*"), | ||
deps = [":library"], | ||
) | ||
|
||
build_test( | ||
name = "build_test", | ||
targets = [ | ||
":plain", | ||
":with_substr_matcher", | ||
":with_basic_regex_matcher", | ||
":with_extended_regex_matcher", | ||
], | ||
) |
8 changes: 8 additions & 0 deletions
8
tests/cc/cpp_compile_error_defines_is_transitive/cpp_compile_error.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
int main() | ||
{ | ||
|
||
#ifdef MACRO_IN_DEFINES | ||
static_assert(false, "With transitive defines, this error must show up"); | ||
#endif | ||
return 0; | ||
} |