brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 359491e Raw
38 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "TweakTesting.h"10#include "gtest/gtest.h"11 12namespace clang {13namespace clangd {14namespace {15 16TWEAK_TEST(AnnotateHighlightings);17 18TEST_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() {}"));23 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();");28 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() {}");33}34 35} // namespace36} // namespace clangd37} // namespace clang38