mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-21 05:06:38 +00:00
The small size is for the 1m vs 5m time limit -- all these tests _should_ be fast so a lower limit seems consistent, and the 5m timeout was getting in my way when trying to debug *actual* timeouts. The Carbon::Testing bit is for convenience -- test libraries are generally using it, it seems like the tests should too. Note this reduces the need for `using`. This does push NodeMatchers into Carbon::Testing -- I don't think this was benefiting from having its own namespace; `using namespace` is discouraged [under style](https://google.github.io/styleguide/cppguide.html#Namespaces), we wouldn't support an equivalent in Carbon, and it feels like it's not helping to avoid name collisions. (also tidy was bugging about it, and while I could NOLINT that, this felt like the better approach)
114 lines
2.8 KiB
Python
114 lines
2.8 KiB
Python
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
load("//bazel/fuzzing:rules.bzl", "cc_fuzz_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
cc_library(
|
|
name = "parse_node_kind",
|
|
srcs = ["parse_node_kind.cpp"],
|
|
hdrs = ["parse_node_kind.h"],
|
|
textual_hdrs = ["parse_node_kind.def"],
|
|
deps = ["@llvm-project//llvm:Support"],
|
|
)
|
|
|
|
cc_test(
|
|
name = "parse_node_kind_test",
|
|
size = "small",
|
|
srcs = ["parse_node_kind_test.cpp"],
|
|
deps = [
|
|
":parse_node_kind",
|
|
"@com_google_googletest//:gtest_main",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "parse_tree",
|
|
srcs = [
|
|
"parse_tree.cpp",
|
|
"parser_impl.cpp",
|
|
"parser_impl.h",
|
|
],
|
|
hdrs = ["parse_tree.h"],
|
|
deps = [
|
|
":parse_node_kind",
|
|
":precedence",
|
|
"//common:check",
|
|
"//toolchain/diagnostics:diagnostic_emitter",
|
|
"//toolchain/lexer:token_kind",
|
|
"//toolchain/lexer:tokenized_buffer",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "parse_test_helpers",
|
|
testonly = 1,
|
|
hdrs = ["parse_test_helpers.h"],
|
|
deps = [
|
|
":parse_node_kind",
|
|
":parse_tree",
|
|
"//toolchain/lexer:tokenized_buffer",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "parse_tree_test",
|
|
size = "small",
|
|
srcs = ["parse_tree_test.cpp"],
|
|
deps = [
|
|
":parse_node_kind",
|
|
":parse_test_helpers",
|
|
":parse_tree",
|
|
"//common:ostream",
|
|
"//toolchain/common:yaml_test_helpers",
|
|
"//toolchain/diagnostics:diagnostic_emitter",
|
|
"//toolchain/diagnostics:mocks",
|
|
"//toolchain/lexer:tokenized_buffer",
|
|
"@com_google_googletest//:gtest_main",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_fuzz_test(
|
|
name = "parse_tree_fuzzer",
|
|
size = "small",
|
|
srcs = ["parse_tree_fuzzer.cpp"],
|
|
corpus = glob(["fuzzer_corpus/*"]),
|
|
deps = [
|
|
":parse_tree",
|
|
"//common:check",
|
|
"//toolchain/diagnostics:diagnostic_emitter",
|
|
"//toolchain/diagnostics:null_diagnostics",
|
|
"//toolchain/lexer:tokenized_buffer",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "precedence",
|
|
srcs = ["precedence.cpp"],
|
|
hdrs = ["precedence.h"],
|
|
deps = [
|
|
"//common:check",
|
|
"//toolchain/lexer:token_kind",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "precedence_test",
|
|
size = "small",
|
|
srcs = ["precedence_test.cpp"],
|
|
deps = [
|
|
":precedence",
|
|
"//toolchain/lexer:token_kind",
|
|
"@com_google_googletest//:gtest_main",
|
|
],
|
|
)
|