mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:10:14 +01:00
Switch gtest to re2, adjust related tests (#2183)
See https://github.com/google/googletest/blob/main/docs/advanced.md#regular-expression-syntax for gtest regex notes. Add framework suffix handling for includes because of a dep being triggered on macos.
This commit is contained in:
@@ -54,16 +54,30 @@ http_archive(
|
||||
urls = ["https://github.com/abseil/abseil-cpp/archive/%s.tar.gz" % abseil_version],
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# RE2 libraries
|
||||
###############################################################################
|
||||
|
||||
# Head as of 2022-09-14.
|
||||
re2_version = "cc1c9db8bf5155d89d10d65998cdb226f676492c"
|
||||
|
||||
http_archive(
|
||||
name = "com_googlesource_code_re2",
|
||||
sha256 = "8ef976c79a300f8c5e880535665bd4ba146fb09fb6d2342f8f1a02d9af29f365",
|
||||
strip_prefix = "re2-%s" % re2_version,
|
||||
urls = ["https://github.com/google/re2/archive/%s.tar.gz" % re2_version],
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# GoogleTest libraries
|
||||
###############################################################################
|
||||
|
||||
# Version as of 2021-12-07. Not a major release, but gets a clang-tidy fix.
|
||||
googletest_version = "4c5650f68866e3c2e60361d5c4c95c6f335fb64b"
|
||||
# Head as of 2022-09-14.
|
||||
googletest_version = "1336c4b6d1a6f4bc6beebccb920e5ff858889292"
|
||||
|
||||
http_archive(
|
||||
name = "com_google_googletest",
|
||||
sha256 = "770e61fa13d51320736c2881ff6279212e4eab8a9100709fff8c44759f61d126",
|
||||
sha256 = "d701aaeb9a258afba27210d746d971042be96c371ddc5a49f1e8914d9ea17e3c",
|
||||
strip_prefix = "googletest-%s" % googletest_version,
|
||||
urls = ["https://github.com/google/googletest/archive/%s.tar.gz" % googletest_version],
|
||||
)
|
||||
|
||||
@@ -112,8 +112,10 @@ def _compute_clang_cpp_include_search_paths(repository_ctx, clang, sysroot):
|
||||
include_begin = output.index("#include <...> search starts here:") + 1
|
||||
include_end = output.index("End of search list.", include_begin)
|
||||
|
||||
# Suffix present on framework paths.
|
||||
framework_suffix = " (framework directory)"
|
||||
return [
|
||||
repository_ctx.path(s.lstrip(" "))
|
||||
repository_ctx.path(s.lstrip(" ").removesuffix(framework_suffix))
|
||||
for s in output[include_begin:include_end]
|
||||
]
|
||||
|
||||
|
||||
@@ -12,11 +12,10 @@ namespace {
|
||||
TEST(CheckTest, CheckTrue) { CARBON_CHECK(true); }
|
||||
|
||||
TEST(CheckTest, CheckFalse) {
|
||||
// TODO: figure out why we can't use \\d+ instead of .+ in these patterns.
|
||||
ASSERT_DEATH({ CARBON_CHECK(false); },
|
||||
"Stack trace:\n"
|
||||
".+\n"
|
||||
"CHECK failure at common/check_test.cpp:.+: false\n");
|
||||
"(.|\n)+\n"
|
||||
"CHECK failure at common/check_test.cpp:\\d+: false\n");
|
||||
}
|
||||
|
||||
TEST(CheckTest, CheckTrueCallbackNotUsed) {
|
||||
|
||||
@@ -18,7 +18,8 @@ using ::testing::MatchesRegex;
|
||||
|
||||
// We restrict symbols to punctuation characters that are expected to be widely
|
||||
// available on modern keyboards used for programming.
|
||||
constexpr llvm::StringLiteral SymbolRegex = "[][{}!@#%^&*()/?\\|;:.,<>=+~-]+";
|
||||
constexpr llvm::StringLiteral SymbolRegex =
|
||||
"[\\[\\]{}!@#%^&*()/?\\\\|;:.,<>=+~-]+";
|
||||
|
||||
// We restrict keywords to be lowercase ASCII letters and underscores.
|
||||
constexpr llvm::StringLiteral KeywordRegex = "[a-z_]+";
|
||||
|
||||
Reference in New Issue
Block a user