[NFC][RISCV] Remove CFIIndex argument from allocateStack (#117871)
[llvm-project.git] / clang-tools-extra / clangd / unittests / tweaks / ShowSelectionTreeTests.cpp
blob4c149a62df3d10285dff0680316e2e88adefa187
1 //===-- ShowSelectionTreeTests.cpp ------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gmock/gmock-matchers.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
14 namespace clang {
15 namespace clangd {
16 namespace {
18 TWEAK_TEST(ShowSelectionTree);
20 TEST_F(ShowSelectionTreeTest, Test) {
21 EXPECT_AVAILABLE("^int f^oo() { re^turn 2 ^+ 2; }");
22 EXPECT_AVAILABLE("/*c^omment*/ int foo() { return 2 ^ + 2; }");
24 const char *Output = R"(message:
25 TranslationUnitDecl
26 VarDecl int x = fcall(2 + 2)
27 .CallExpr fcall(2 + 2)
28 ImplicitCastExpr fcall
29 .DeclRefExpr fcall
30 .BinaryOperator 2 + 2
31 *IntegerLiteral 2
32 )";
33 EXPECT_EQ(apply("int fcall(int); int x = fca[[ll(2 +]]2);"), Output);
35 Output = R"(message:
36 TranslationUnitDecl
37 FunctionDecl void x()
38 CompoundStmt { …
39 ForStmt for (;;) …
40 *BreakStmt break;
41 )";
42 EXPECT_EQ(apply("void x() { for (;;) br^eak; }"), Output);
45 } // namespace
46 } // namespace clangd
47 } // namespace clang