Skip to content

Commit 2bce3e2

Browse files
authored
add bazel build rule for SelfTest (#2857)
This PR primarily accomplishes two tasks: 1) It adds MODULE.bazel.lock to the .gitignore file. 2) It includes a Bazel build rule for SelfTest, which can be utilized with the command bazel test //tests:catch2_self_test.
1 parent df04df9 commit 2bce3e2

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ benchmark-dir
2727
.conan/test_package/build
2828
.conan/test_package/CMakeUserPresets.json
2929
bazel-*
30+
MODULE.bazel.lock
3031
build-fuzzers
3132
debug-build
3233
.vscode

tests/BUILD.bazel

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
cc_library(
6+
name = "catch2_self_test_helper",
7+
srcs = ["SelfTest/helpers/parse_test_spec.cpp"],
8+
hdrs = [
9+
"SelfTest/helpers/parse_test_spec.hpp",
10+
"SelfTest/helpers/range_test_helpers.hpp",
11+
"SelfTest/helpers/type_with_lit_0_comparisons.hpp",
12+
],
13+
includes = ["SelfTest"],
14+
deps = [
15+
"//:catch2",
16+
],
17+
)
18+
19+
cc_test(
20+
name = "catch2_self_test",
21+
size = "small",
22+
srcs = [
23+
"SelfTest/IntrospectiveTests/Algorithms.tests.cpp",
24+
"SelfTest/IntrospectiveTests/Clara.tests.cpp",
25+
"SelfTest/IntrospectiveTests/CmdLine.tests.cpp",
26+
"SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp",
27+
"SelfTest/IntrospectiveTests/ColourImpl.tests.cpp",
28+
"SelfTest/IntrospectiveTests/Details.tests.cpp",
29+
"SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp",
30+
"SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp",
31+
"SelfTest/IntrospectiveTests/Integer.tests.cpp",
32+
"SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp",
33+
"SelfTest/IntrospectiveTests/Parse.tests.cpp",
34+
"SelfTest/IntrospectiveTests/PartTracker.tests.cpp",
35+
"SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp",
36+
"SelfTest/IntrospectiveTests/Reporters.tests.cpp",
37+
"SelfTest/IntrospectiveTests/Sharding.tests.cpp",
38+
"SelfTest/IntrospectiveTests/Stream.tests.cpp",
39+
"SelfTest/IntrospectiveTests/String.tests.cpp",
40+
"SelfTest/IntrospectiveTests/StringManip.tests.cpp",
41+
"SelfTest/IntrospectiveTests/Tag.tests.cpp",
42+
"SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp",
43+
"SelfTest/IntrospectiveTests/TestSpec.tests.cpp",
44+
"SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp",
45+
"SelfTest/IntrospectiveTests/TextFlow.tests.cpp",
46+
"SelfTest/IntrospectiveTests/ToString.tests.cpp",
47+
"SelfTest/IntrospectiveTests/Traits.tests.cpp",
48+
"SelfTest/IntrospectiveTests/UniquePtr.tests.cpp",
49+
"SelfTest/IntrospectiveTests/Xml.tests.cpp",
50+
"SelfTest/TestRegistrations.cpp",
51+
"SelfTest/TimingTests/Sleep.tests.cpp",
52+
"SelfTest/UsageTests/Approx.tests.cpp",
53+
"SelfTest/UsageTests/BDD.tests.cpp",
54+
"SelfTest/UsageTests/Benchmark.tests.cpp",
55+
"SelfTest/UsageTests/Class.tests.cpp",
56+
"SelfTest/UsageTests/Compilation.tests.cpp",
57+
"SelfTest/UsageTests/Condition.tests.cpp",
58+
"SelfTest/UsageTests/Decomposition.tests.cpp",
59+
"SelfTest/UsageTests/EnumToString.tests.cpp",
60+
"SelfTest/UsageTests/Exception.tests.cpp",
61+
"SelfTest/UsageTests/Generators.tests.cpp",
62+
"SelfTest/UsageTests/Matchers.tests.cpp",
63+
"SelfTest/UsageTests/MatchersRanges.tests.cpp",
64+
"SelfTest/UsageTests/Message.tests.cpp",
65+
"SelfTest/UsageTests/Misc.tests.cpp",
66+
"SelfTest/UsageTests/ToStringByte.tests.cpp",
67+
"SelfTest/UsageTests/ToStringChrono.tests.cpp",
68+
"SelfTest/UsageTests/ToStringGeneral.tests.cpp",
69+
"SelfTest/UsageTests/ToStringOptional.tests.cpp",
70+
"SelfTest/UsageTests/ToStringPair.tests.cpp",
71+
"SelfTest/UsageTests/ToStringTuple.tests.cpp",
72+
"SelfTest/UsageTests/ToStringVariant.tests.cpp",
73+
"SelfTest/UsageTests/ToStringVector.tests.cpp",
74+
"SelfTest/UsageTests/ToStringWhich.tests.cpp",
75+
"SelfTest/UsageTests/Tricky.tests.cpp",
76+
"SelfTest/UsageTests/VariadicMacros.tests.cpp",
77+
],
78+
deps = [
79+
":catch2_self_test_helper",
80+
"//:catch2",
81+
"//:catch2_main",
82+
],
83+
)

0 commit comments

Comments
 (0)