parse_test_matchers.h 790 B

1234567891011121314151617181920212223
  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 EXECUTABLE_SEMANTICS_SYNTAX_PARSE_TEST_MATCHERS_H_
  5. #define EXECUTABLE_SEMANTICS_SYNTAX_PARSE_TEST_MATCHERS_H_
  6. #include <gmock/gmock.h>
  7. #include <gtest/gtest.h>
  8. #include "executable_semantics/syntax/parse_test_matchers_internal.h"
  9. namespace Carbon {
  10. // Matches the return value of `Parse()` if it represents a successful parse
  11. // whose output matches the given matcher.
  12. inline auto ParsedAs(::testing::Matcher<AST> ast_matcher) {
  13. return TestingInternal::ParsedAsMatcher(std::move(ast_matcher));
  14. }
  15. } // namespace Carbon
  16. #endif // EXECUTABLE_SEMANTICS_SYNTAX_PARSE_TEST_MATCHERS_H_