mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:00:12 +01:00
Previous code could fail silently, only caught with yaml output mismatches. This uses ErrorOr to be explicit about the error detection; recovery isn't supported because we should only print valid yaml (in tests, at least). Also moves the test helpers from //toolchain/base to //toolchain/testing. Switches tree_test to use the matchers so that, on mismatch, gtest prints a path to the mismatch (the straight value means it was just printing "not equal"). Addresses https://github.com/carbon-language/carbon-lang/pull/3217#discussion_r1323586836
51 lines
1.3 KiB
Python
51 lines
1.3 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("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
|
load("//testing/file_test:rules.bzl", "file_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
file_test(
|
|
name = "file_test",
|
|
srcs = ["file_test.cpp"],
|
|
tests = [
|
|
"//toolchain/check:testdata",
|
|
"//toolchain/codegen:testdata",
|
|
"//toolchain/driver:testdata",
|
|
"//toolchain/lex:testdata",
|
|
"//toolchain/lower:testdata",
|
|
"//toolchain/parse:testdata",
|
|
],
|
|
deps = [
|
|
"//testing/file_test:file_test_base",
|
|
"//toolchain/driver",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "yaml_test_helpers",
|
|
testonly = 1,
|
|
srcs = ["yaml_test_helpers.cpp"],
|
|
hdrs = ["yaml_test_helpers.h"],
|
|
deps = [
|
|
"//common:error",
|
|
"//common:ostream",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "yaml_test_helpers_test",
|
|
size = "small",
|
|
srcs = ["yaml_test_helpers_test.cpp"],
|
|
deps = [
|
|
":yaml_test_helpers",
|
|
"//testing/base:gtest_main",
|
|
"@com_google_googletest//:gtest",
|
|
],
|
|
)
|