1*5934a791SAdam Czachorowski //===-- DumpASTTests.cpp ----------------------------------------*- C++ -*-===// 2*5934a791SAdam Czachorowski // 3*5934a791SAdam Czachorowski // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*5934a791SAdam Czachorowski // See https://llvm.org/LICENSE.txt for license information. 5*5934a791SAdam Czachorowski // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*5934a791SAdam Czachorowski // 7*5934a791SAdam Czachorowski //===----------------------------------------------------------------------===// 8*5934a791SAdam Czachorowski 9*5934a791SAdam Czachorowski #include "TweakTesting.h" 10*5934a791SAdam Czachorowski #include "gmock/gmock.h" 11*5934a791SAdam Czachorowski #include "gtest/gtest.h" 12*5934a791SAdam Czachorowski 13*5934a791SAdam Czachorowski using ::testing::AllOf; 14*5934a791SAdam Czachorowski using ::testing::HasSubstr; 15*5934a791SAdam Czachorowski using ::testing::StartsWith; 16*5934a791SAdam Czachorowski 17*5934a791SAdam Czachorowski namespace clang { 18*5934a791SAdam Czachorowski namespace clangd { 19*5934a791SAdam Czachorowski namespace { 20*5934a791SAdam Czachorowski 21*5934a791SAdam Czachorowski TWEAK_TEST(DumpAST); 22*5934a791SAdam Czachorowski TEST_F(DumpASTTest,Test)23*5934a791SAdam CzachorowskiTEST_F(DumpASTTest, Test) { 24*5934a791SAdam Czachorowski EXPECT_AVAILABLE("^int f^oo() { re^turn 2 ^+ 2; }"); 25*5934a791SAdam Czachorowski EXPECT_UNAVAILABLE("/*c^omment*/ int foo() { return 2 ^ + 2; }"); 26*5934a791SAdam Czachorowski EXPECT_THAT(apply("int x = 2 ^+ 2;"), 27*5934a791SAdam Czachorowski AllOf(StartsWith("message:"), HasSubstr("BinaryOperator"), 28*5934a791SAdam Czachorowski HasSubstr("'+'"), HasSubstr("|-IntegerLiteral"), 29*5934a791SAdam Czachorowski HasSubstr("<col:9> 'int' 2\n`-IntegerLiteral"), 30*5934a791SAdam Czachorowski HasSubstr("<col:13> 'int' 2"))); 31*5934a791SAdam Czachorowski } 32*5934a791SAdam Czachorowski 33*5934a791SAdam Czachorowski } // namespace 34*5934a791SAdam Czachorowski } // namespace clangd 35*5934a791SAdam Czachorowski } // namespace clang 36