coverage_test.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include <gtest/gtest.h>
  5. #include "absl/flags/flag.h"
  6. #include "toolchain/parse/node_kind.h"
  7. #include "toolchain/testing/coverage_helper.h"
  8. ABSL_FLAG(std::string, testdata_manifest, "",
  9. "A path to a file containing repo-relative names of test files.");
  10. namespace Carbon::Parse {
  11. namespace {
  12. constexpr NodeKind NodeKinds[] = {
  13. #define CARBON_PARSE_NODE_KIND(Name) NodeKind::Name,
  14. #include "toolchain/parse/node_kind.def"
  15. };
  16. constexpr NodeKind UntestedNodeKinds[] = {NodeKind::Placeholder};
  17. // Looks for node kinds that aren't covered by a file_test.
  18. TEST(Coverage, NodeKind) {
  19. Testing::TestKindCoverage(absl::GetFlag(FLAGS_testdata_manifest),
  20. R"(kind: '(\w+)')", llvm::ArrayRef(NodeKinds),
  21. llvm::ArrayRef(UntestedNodeKinds));
  22. }
  23. } // namespace
  24. } // namespace Carbon::Parse