Bump version to 19.1.0git
[llvm-project.git] / clang-tools-extra / clangd / unittests / tweaks / AnnotateHighlightingsTests.cpp
blob359491e9ddb950393b14e4f4321fff260cc43ea5
1 //===-- AnnotateHighlightingsTests.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 "gtest/gtest.h"
12 namespace clang {
13 namespace clangd {
14 namespace {
16 TWEAK_TEST(AnnotateHighlightings);
18 TEST_F(AnnotateHighlightingsTest, Test) {
19 EXPECT_AVAILABLE("^vo^id^ ^f(^) {^}^"); // available everywhere.
20 EXPECT_AVAILABLE("[[int a; int b;]]");
21 EXPECT_EQ("void /* Function [decl] [def] [globalScope] */f() {}",
22 apply("void ^f() {}"));
24 EXPECT_EQ(apply("[[int f1(); const int x = f1();]]"),
25 "int /* Function [decl] [globalScope] */f1(); "
26 "const int /* Variable [decl] [def] [readonly] [fileScope] */x = "
27 "/* Function [globalScope] */f1();");
29 // Only the targeted range is annotated.
30 EXPECT_EQ(apply("void f1(); void f2() {^}"),
31 "void f1(); "
32 "void /* Function [decl] [def] [globalScope] */f2() {}");
35 } // namespace
36 } // namespace clangd
37 } // namespace clang