declared_name_test_matchers.h 1016 B

12345678910111213141516171819202122232425262728
  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. #ifndef CARBON_TOOLCHAIN_SEMANTICS_NODES_DECLARED_NAME_TEST_MATCHERS_H_
  5. #define CARBON_TOOLCHAIN_SEMANTICS_NODES_DECLARED_NAME_TEST_MATCHERS_H_
  6. #include <gtest/gtest.h>
  7. #include "llvm/ADT/StringExtras.h"
  8. #include "toolchain/semantics/nodes/declared_name.h"
  9. #include "toolchain/semantics/semantics_ir_for_test.h"
  10. namespace Carbon::Testing {
  11. MATCHER_P(
  12. DeclaredName, name_matcher,
  13. llvm::formatv("DeclaredName {0}",
  14. ::testing::DescribeMatcher<llvm::StringRef>(name_matcher))) {
  15. const Semantics::DeclaredName& name = arg;
  16. return ExplainMatchResult(name_matcher,
  17. SemanticsIRForTest::GetNodeText(name.node()),
  18. result_listener);
  19. }
  20. } // namespace Carbon::Testing
  21. #endif // CARBON_TOOLCHAIN_SEMANTICS_NODES_DECLARED_NAME_TEST_MATCHERS_H_