1 //===-- AnnotateHighlightingsTests.cpp --------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gtest/gtest.h"
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] [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] [readonly] [fileScope] */x = "
27 "/* Function [globalScope] */f1();");
29 // Only the targeted range is annotated.
30 EXPECT_EQ(apply("void f1(); void f2() {^}"),
32 "void /* Function [decl] [globalScope] */f2() {}");