Add tests to the Bazel builds.

This commit is contained in:
bcsgh 2025-03-16 17:46:38 -07:00
parent 8fcfda4f1c
commit 0383d14b76
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,6 @@
cc_binary(
name = "jsontestrunner",
srcs = ["main.cpp"],
deps = ["//:jsoncpp"],
visibility = ["//test:__pkg__"],
)

View File

@ -0,0 +1,11 @@
cc_test(
name = "jsoncpp_test",
srcs = [
"jsontest.cpp",
"jsontest.h",
"main.cpp",
"fuzz.h",
"fuzz.cpp",
],
deps = ["//:jsoncpp"],
)

22
test/BUILD.bazel Normal file
View File

@ -0,0 +1,22 @@
filegroup(
name = "expected",
srcs = glob(["data/**", "jsonchecker/**"], exclude=["**/*.json"]),
)
########
[py_test(
name = "runjson_%s_test" % "_".join(f.split("/")),
srcs = ["runjsontests.py"],
main = "runjsontests.py",
args = [
"--with-json-checker",
"$(location //src/jsontestrunner:jsontestrunner)",
"$(location :%s)" % f,
],
data = [
"//src/jsontestrunner:jsontestrunner",
":expected",
":%s" % f,
],
) for f in glob(["**/*.json"])]