highlightingmarks-test.cpp 37.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

Marco Bubke's avatar
Marco Bubke committed
26
#include "googletest.h"
27
#include "testenvironment.h"
Marco Bubke's avatar
Marco Bubke committed
28

29 30
#include <clangdocument.h>
#include <clangdocuments.h>
31
#include <clangtranslationunit.h>
32
#include <cursor.h>
33
#include <clangsupport_global.h>
34 35 36 37 38 39 40 41 42
#include <clangstring.h>
#include <projectpart.h>
#include <projects.h>
#include <sourcelocation.h>
#include <sourcerange.h>
#include <highlightingmark.h>
#include <highlightingmarks.h>
#include <unsavedfiles.h>

43 44
#include <clang-c/Index.h>

45
using ClangBackEnd::Cursor;
46
using ClangBackEnd::HighlightingTypes;
47 48 49
using ClangBackEnd::HighlightingMark;
using ClangBackEnd::HighlightingMarks;
using ClangBackEnd::HighlightingType;
50 51
using ClangBackEnd::Document;
using ClangBackEnd::Documents;
52
using ClangBackEnd::TranslationUnit;
53 54 55 56 57 58 59 60 61 62
using ClangBackEnd::UnsavedFiles;
using ClangBackEnd::ProjectPart;
using ClangBackEnd::ClangString;
using ClangBackEnd::SourceRange;

using testing::PrintToString;
using testing::IsNull;
using testing::NotNull;
using testing::Gt;
using testing::Contains;
63 64
using testing::ElementsAre;
using testing::_;
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
using testing::EndsWith;
using testing::AllOf;
using testing::Not;
using testing::IsEmpty;
using testing::SizeIs;

namespace {

MATCHER_P4(IsHighlightingMark, line, column, length, type,
           std::string(negation ? "isn't " : "is ")
           + PrintToString(HighlightingMark(line, column, length, type))
           )
{
    const HighlightingMark expected(line, column, length, type);

    return arg == expected;
}

83
MATCHER_P(HasOnlyType, type,
84 85 86 87
          std::string(negation ? "isn't " : "is ")
          + PrintToString(type)
          )
{
88 89 90 91 92 93 94 95 96 97 98
    return arg.hasOnlyType(type);
}

MATCHER_P2(HasTwoTypes, firstType, secondType,
           std::string(negation ? "isn't " : "is ")
           + PrintToString(firstType)
           + " and "
           + PrintToString(secondType)
           )
{
    return arg.hasMainType(firstType) && arg.hasMixinType(secondType);
99 100
}

101 102 103 104 105 106 107 108
MATCHER_P(HasMixin, firstType,
          std::string(negation ? "isn't " : "is ")
          + PrintToString(firstType)
          )
{
    return  arg.hasMixinType(firstType);
}

109
struct Data {
110 111
    Data()
    {
112
        document.parse();
113 114
    }

115 116
    ClangBackEnd::ProjectParts projects;
    ClangBackEnd::UnsavedFiles unsavedFiles;
117
    ClangBackEnd::Documents documents{projects, unsavedFiles};
118
    Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/highlightingmarks.cpp")};
119 120
    Document document{filePath,
                      ProjectPart(Utf8StringLiteral("projectPartId"),
121 122
                                  TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++14"),
                                                                         Utf8StringLiteral("-I" TESTDATA_DIR)})),
123 124
                      {},
                      documents};
125
    TranslationUnit translationUnit{filePath,
126
                                    filePath,
127 128
                                    document.translationUnit().cxIndex(),
                                    document.translationUnit().cxTranslationUnit()};
129 130 131 132 133 134 135 136 137 138 139 140
};

class HighlightingMarks : public ::testing::Test
{
public:
    static void SetUpTestCase();
    static void TearDownTestCase();

    SourceRange sourceRange(uint line, uint columnEnd) const;

protected:
    static Data *d;
141
    const TranslationUnit &translationUnit = d->translationUnit;
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
};

TEST_F(HighlightingMarks, CreateNullInformations)
{
    ::HighlightingMarks infos;

    ASSERT_TRUE(infos.isNull());
}

TEST_F(HighlightingMarks, NullInformationsAreEmpty)
{
    ::HighlightingMarks infos;

    ASSERT_TRUE(infos.isEmpty());
}

TEST_F(HighlightingMarks, IsNotNull)
{
160
    const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
161

162
    const auto infos = translationUnit.highlightingMarksInRange(aRange);
163 164 165 166 167 168

    ASSERT_FALSE(infos.isNull());
}

TEST_F(HighlightingMarks, IteratorBeginEnd)
{
169 170
    const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
    const auto infos = translationUnit.highlightingMarksInRange(aRange);
171 172 173 174 175 176 177 178

    const auto endIterator = std::next(infos.begin(), infos.size());

    ASSERT_THAT(infos.end(), endIterator);
}

TEST_F(HighlightingMarks, ForFullTranslationUnitRange)
{
179
    const auto infos = translationUnit.highlightingMarks();
180 181 182 183 184 185 186

    ASSERT_THAT(infos, AllOf(Contains(IsHighlightingMark(1u, 1u, 4u, HighlightingType::Keyword)),
                             Contains(IsHighlightingMark(277u, 5u, 15u, HighlightingType::Function))));
}

TEST_F(HighlightingMarks, Size)
{
187
    const auto range = translationUnit.sourceRange(5, 5, 5, 10);
188

189
    const auto infos = translationUnit.highlightingMarksInRange(range);
190 191 192 193 194 195

    ASSERT_THAT(infos.size(), 1);
}

TEST_F(HighlightingMarks, DISABLED_Keyword)
{
196
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(5, 12));
197 198 199 200 201 202

    ASSERT_THAT(infos[0], IsHighlightingMark(5u, 5u, 6u, HighlightingType::Keyword));
}

TEST_F(HighlightingMarks, StringLiteral)
{
203
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(1, 29));
204 205 206 207 208 209

    ASSERT_THAT(infos[4], IsHighlightingMark(1u, 24u, 10u, HighlightingType::StringLiteral));
}

TEST_F(HighlightingMarks, Utf8StringLiteral)
{
210
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(2, 33));
211 212 213 214 215 216

    ASSERT_THAT(infos[4], IsHighlightingMark(2u, 24u, 12u, HighlightingType::StringLiteral));
}

TEST_F(HighlightingMarks, RawStringLiteral)
{
217
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(3, 34));
218 219 220 221 222 223

    ASSERT_THAT(infos[4], IsHighlightingMark(3u, 24u, 13u, HighlightingType::StringLiteral));
}

TEST_F(HighlightingMarks, CharacterLiteral)
{
224
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(4, 28));
225 226 227 228 229 230

    ASSERT_THAT(infos[3], IsHighlightingMark(4u, 24u, 3u, HighlightingType::StringLiteral));
}

TEST_F(HighlightingMarks, IntegerLiteral)
{
231
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(23, 26));
232 233 234 235 236 237

    ASSERT_THAT(infos[3], IsHighlightingMark(23u, 24u, 1u, HighlightingType::NumberLiteral));
}

TEST_F(HighlightingMarks, FloatLiteral)
{
238
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(24, 29));
239 240 241 242 243 244

    ASSERT_THAT(infos[3], IsHighlightingMark(24u, 24u, 4u, HighlightingType::NumberLiteral));
}

TEST_F(HighlightingMarks, FunctionDefinition)
{
245
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(45, 20));
246

247
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
248 249 250 251
}

TEST_F(HighlightingMarks, MemberFunctionDefinition)
{
252
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(52, 29));
253

254
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
255 256 257 258
}

TEST_F(HighlightingMarks, FunctionDeclaration)
{
259
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(55, 32));
260

261
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
262 263 264 265
}

TEST_F(HighlightingMarks, MemberFunctionDeclaration)
{
266
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(59, 27));
267

268
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
269 270 271 272
}

TEST_F(HighlightingMarks, MemberFunctionReference)
{
273
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(104, 35));
274 275 276 277 278 279

    ASSERT_THAT(infos[0], IsHighlightingMark(104u, 9u, 23u, HighlightingType::Function));
}

TEST_F(HighlightingMarks, FunctionCall)
{
280
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(64, 16));
281

282
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
283 284 285 286
}

TEST_F(HighlightingMarks, TypeConversionFunction)
{
287
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(68, 20));
288 289 290 291 292 293

    ASSERT_THAT(infos[1], IsHighlightingMark(68u, 14u, 3u, HighlightingType::Type));
}

TEST_F(HighlightingMarks, InbuiltTypeConversionFunction)
{
294
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(69, 20));
295

296
    ASSERT_THAT(infos[1], IsHighlightingMark(69u, 14u, 3u, HighlightingType::PrimitiveType));
297 298 299 300
}

TEST_F(HighlightingMarks, TypeReference)
{
301
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(74, 13));
302 303 304 305 306 307

    ASSERT_THAT(infos[0], IsHighlightingMark(74u, 5u, 3u, HighlightingType::Type));
}

TEST_F(HighlightingMarks, LocalVariable)
{
308
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
309 310 311 312 313 314

    ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, LocalVariableDeclaration)
{
315
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
316 317 318 319 320 321

    ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, LocalVariableReference)
{
322
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(81, 26));
323 324 325 326 327 328

    ASSERT_THAT(infos[0], IsHighlightingMark(81u, 5u, 3u, HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, LocalVariableFunctionArgumentDeclaration)
{
329
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(84, 45));
330 331 332 333 334 335

    ASSERT_THAT(infos[5], IsHighlightingMark(84u, 41u, 3u, HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, LocalVariableFunctionArgumentReference)
{
336
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(86, 26));
337 338 339 340 341 342

    ASSERT_THAT(infos[0], IsHighlightingMark(86u, 5u, 3u, HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, ClassVariableDeclaration)
{
343
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(90, 21));
344 345 346 347 348 349

    ASSERT_THAT(infos[1], IsHighlightingMark(90u, 9u, 11u, HighlightingType::Field));
}

TEST_F(HighlightingMarks, ClassVariableReference)
{
350
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(94, 23));
351 352 353 354 355 356

    ASSERT_THAT(infos[0], IsHighlightingMark(94u, 9u, 11u, HighlightingType::Field));
}

TEST_F(HighlightingMarks, StaticMethodDeclaration)
{
357
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(110, 25));
358

359
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
360 361 362 363
}

TEST_F(HighlightingMarks, StaticMethodReference)
{
364
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(114, 30));
365

366
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
367 368 369 370
}

TEST_F(HighlightingMarks, Enumeration)
{
371
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(118, 17));
372

373
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
374 375 376 377
}

TEST_F(HighlightingMarks, Enumerator)
{
378
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(120, 15));
379

380
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Enumeration));
381 382 383 384
}

TEST_F(HighlightingMarks, EnumerationReferenceDeclarationType)
{
385
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
386

387
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
388 389 390 391
}

TEST_F(HighlightingMarks, EnumerationReferenceDeclarationVariable)
{
392
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
393

394
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
395 396 397 398
}

TEST_F(HighlightingMarks, EnumerationReference)
{
399
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
400

401
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::LocalVariable));
402 403 404 405
}

TEST_F(HighlightingMarks, EnumeratorReference)
{
406
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
407

408
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Enumeration));
409 410 411 412
}

TEST_F(HighlightingMarks, ClassForwardDeclaration)
{
413
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(130, 12));
414

415
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
416 417 418 419
}

TEST_F(HighlightingMarks, ConstructorDeclaration)
{
420
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(134, 13));
421

422
    ASSERT_THAT(infos[0], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
423 424 425 426
}

TEST_F(HighlightingMarks, DestructorDeclaration)
{
427
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(135, 15));
428

429
    ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
430 431 432 433
}

TEST_F(HighlightingMarks, ClassForwardDeclarationReference)
{
434
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(138, 23));
435

436
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
437 438 439 440
}

TEST_F(HighlightingMarks, ClassTypeReference)
{
441
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
442

443
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
444 445 446 447
}

TEST_F(HighlightingMarks, ConstructorReferenceVariable)
{
448
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
449

450
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
451 452 453 454
}

TEST_F(HighlightingMarks, UnionDeclaration)
{
455
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(145, 12));
456

457
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
458 459 460 461
}

TEST_F(HighlightingMarks, UnionDeclarationReference)
{
462
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
463

464
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
465 466 467 468
}

TEST_F(HighlightingMarks, GlobalVariable)
{
469
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
470

471
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::GlobalVariable));
472 473 474 475
}

TEST_F(HighlightingMarks, StructDeclaration)
{
476
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(50, 11));
477

478
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
479 480 481 482
}

TEST_F(HighlightingMarks, NameSpace)
{
483
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(160, 22));
484

485
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
486 487 488 489
}

TEST_F(HighlightingMarks, NameSpaceAlias)
{
490
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(164, 38));
491

492
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
493 494 495 496
}

TEST_F(HighlightingMarks, UsingStructInNameSpace)
{
497
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(165, 36));
498

499
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
500 501 502 503
}

TEST_F(HighlightingMarks, NameSpaceReference)
{
504
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
505

506
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
507 508 509 510
}

TEST_F(HighlightingMarks, StructInNameSpaceReference)
{
511
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
512

513
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
514 515
}

516
TEST_F(HighlightingMarks, VirtualFunctionDeclaration)
517
{
518
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(170, 35));
519

520
    ASSERT_THAT(infos[2], HasTwoTypes(HighlightingType::VirtualFunction, HighlightingType::Declaration));
521 522 523 524
}

TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCall)
{
525
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(177, 46));
526

527
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
528 529 530 531
}

TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCallPointer)
{
532
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(180, 54));
533

534
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
535 536 537 538
}

TEST_F(HighlightingMarks, VirtualFunctionCallPointer)
{
539
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(192, 51));
540

541
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
542 543 544 545
}

TEST_F(HighlightingMarks, FinalVirtualFunctionCallPointer)
{
546
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(202, 61));
547

548
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
549 550 551 552
}

TEST_F(HighlightingMarks, NonFinalVirtualFunctionCallPointer)
{
553
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(207, 61));
554

555
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
556 557 558 559
}

TEST_F(HighlightingMarks, PlusOperator)
{
560
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(224, 49));
561

562
    ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Operator));
563 564 565 566
}

TEST_F(HighlightingMarks, PlusAssignOperator)
{
567
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(226, 24));
568

569
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Operator));
570 571 572 573
}

TEST_F(HighlightingMarks, Comment)
{
574
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(229, 14));
575

576
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Comment));
577 578 579 580
}

TEST_F(HighlightingMarks, PreprocessingDirective)
{
581
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
582

583
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
584 585 586 587
}

TEST_F(HighlightingMarks, PreprocessorMacroDefinition)
{
588
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
589

590
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
591 592 593 594
}

TEST_F(HighlightingMarks, PreprocessorFunctionMacroDefinition)
{
595
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(232, 47));
596

597
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
598 599 600 601
}

TEST_F(HighlightingMarks, PreprocessorMacroExpansion)
{
602
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
603

604
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::PreprocessorExpansion));
605 606 607 608
}

TEST_F(HighlightingMarks, PreprocessorMacroExpansionArgument)
{
609
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
610

611
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::NumberLiteral));
612 613 614 615
}

TEST_F(HighlightingMarks, PreprocessorInclusionDirective)
{
616
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(239, 18));
617

618
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::StringLiteral));
619 620 621 622
}

TEST_F(HighlightingMarks, GotoLabelStatement)
{
623
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(242, 12));
624

625
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Label));
626 627 628 629
}

TEST_F(HighlightingMarks, GotoLabelStatementReference)
{
630
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(244, 21));
631

632
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Label));
633 634 635 636
}

TEST_F(HighlightingMarks, TemplateReference)
{
637
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(254, 25));
638

639
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
640 641 642 643
}

TEST_F(HighlightingMarks, TemplateTypeParameter)
{
644
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
645

646
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
647 648 649 650
}

TEST_F(HighlightingMarks, TemplateDefaultParameter)
{
651
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
652

653
    ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Type));
654 655 656 657
}

TEST_F(HighlightingMarks, NonTypeTemplateParameter)
{
658
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
659

660
    ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::LocalVariable));
661 662 663 664
}

TEST_F(HighlightingMarks, NonTypeTemplateParameterDefaultArgument)
{
665
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
666

667
    ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::NumberLiteral));
668 669 670 671
}

TEST_F(HighlightingMarks, TemplateTemplateParameter)
{
672
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
673

674
    ASSERT_THAT(infos[17], HasOnlyType(HighlightingType::Type));
675 676 677 678
}

TEST_F(HighlightingMarks, TemplateTemplateParameterDefaultArgument)
{
679
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
680

681
    ASSERT_THAT(infos[19], HasOnlyType(HighlightingType::Type));
682 683 684 685
}

TEST_F(HighlightingMarks, TemplateFunctionDeclaration)
{
686
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(266, 63));
687

688
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Function));
689 690
}

691
TEST_F(HighlightingMarks, TemplateTypeParameterReference)
692
{
693
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
694

695
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
696 697
}

698
TEST_F(HighlightingMarks, TemplateTypeParameterDeclarationReference)
699
{
700
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
701

702
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
703 704
}

705
TEST_F(HighlightingMarks, NonTypeTemplateParameterReference)
706
{
707
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
708

709
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::LocalVariable));
710 711
}

712
TEST_F(HighlightingMarks, NonTypeTemplateParameterReferenceReference)
713
{
714
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
715

716
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
717 718
}

719
TEST_F(HighlightingMarks, TemplateTemplateParameterReference)
720
{
721
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
722

723
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
724 725
}

726
TEST_F(HighlightingMarks, TemplateTemplateContainerParameterReference)
727
{
728
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
729

730
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
731 732
}

733
TEST_F(HighlightingMarks, TemplateTemplateParameterReferenceVariable)
734
{
735
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
736

737
    ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::LocalVariable));
738 739 740 741
}

TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCallPointer)
{
742
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(212, 61));
743

744
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
745 746 747 748
}

TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCall)
{
749
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(277, 23));
750

751
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
752 753 754 755
}

TEST_F(HighlightingMarks, HasFunctionArguments)
{
756
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(286, 29));
757 758 759 760 761 762

    ASSERT_TRUE(infos[1].hasFunctionArguments());
}

TEST_F(HighlightingMarks, PreprocessorInclusionDirectiveWithAngleBrackets )
{
763
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(289, 38));
764

765
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::StringLiteral));
766 767 768 769
}

TEST_F(HighlightingMarks, ArgumentInMacroExpansionIsKeyword)
{
770
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
771

772
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PrimitiveType));
773 774 775 776
}

TEST_F(HighlightingMarks, DISABLED_FirstArgumentInMacroExpansionIsLocalVariable)
{
777
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
778

779
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
780 781 782 783
}

TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsLocalVariable)
{
784
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
785

786
    ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
787 788 789 790
}

TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsField)
{
791
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(310, 40));
792

793
    ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
794 795 796
}


797
TEST_F(HighlightingMarks, EnumerationType)
798
{
799
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(316, 30));
800

801
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
802 803 804 805
}

TEST_F(HighlightingMarks, TypeInStaticCast)
{
806
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
807

808
    ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
809 810 811 812
}

TEST_F(HighlightingMarks, StaticCastIsKeyword)
{
813
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
814

815
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Keyword));
816 817 818 819
}

TEST_F(HighlightingMarks, StaticCastPunctationIsInvalid)
{
820
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
821

822 823 824
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
    ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
825 826 827 828
}

TEST_F(HighlightingMarks, TypeInReinterpretCast)
{
829
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(329, 69));
830

831
    ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
832 833 834 835
}

TEST_F(HighlightingMarks, IntegerAliasDeclaration)
{
836
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(333, 41));
837

838
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
839 840 841 842
}

TEST_F(HighlightingMarks, IntegerAlias)
{
843
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(341, 31));
844

845
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
846 847 848 849
}

TEST_F(HighlightingMarks, SecondIntegerAlias)
{
850
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(342, 43));
851

852
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
853 854 855 856
}

TEST_F(HighlightingMarks, IntegerTypedef)
{
857
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(343, 35));
858

859
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
860 861 862 863
}

TEST_F(HighlightingMarks, FunctionAlias)
{
864
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(344, 16));
865

866
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
867 868
}

869
TEST_F(HighlightingMarks, DISABLED_ON_CLANG3(FriendTypeDeclaration))
870
{
871
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(350, 28));
872

873
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
874 875
}

876
TEST_F(HighlightingMarks, DISABLED_ON_CLANG3(FriendArgumentTypeDeclaration))
877
{
878
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
879

880
    ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Type));
881 882
}

883
TEST_F(HighlightingMarks, DISABLED_ON_CLANG3(FriendArgumentDeclaration))
884
{
885
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
886

887
    ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::LocalVariable));
888 889 890 891
}

TEST_F(HighlightingMarks, FieldInitialization)
{
892
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(358, 18));
893

894
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Field));
895 896 897 898
}

TEST_F(HighlightingMarks, TemplateFunctionCall)
{
899
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(372, 29));
900

901
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
902 903 904 905
}

TEST_F(HighlightingMarks, TemplatedType)
{
906
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(377, 21));
907

908
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
909 910 911 912
}

TEST_F(HighlightingMarks, TemplatedTypeDeclaration)
{
913
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(384, 49));
914

915
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
916 917 918 919
}

TEST_F(HighlightingMarks, NoOperator)
{
920
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(389, 24));
921

922
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Invalid));
923 924 925 926
}

TEST_F(HighlightingMarks, ScopeOperator)
{
927
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(400, 33));
928

929
    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
930 931 932 933
}

TEST_F(HighlightingMarks, TemplateClassNamespace)
{
934
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
935

936
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
937 938 939 940
}

TEST_F(HighlightingMarks, TemplateClass)
{
941
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
942

943
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
944 945 946 947
}

TEST_F(HighlightingMarks, TemplateClassParameter)
{
948
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
949

950
    ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
951 952 953 954
}

TEST_F(HighlightingMarks, TemplateClassDeclaration)
{
955
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
956

957
    ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::LocalVariable));
958 959 960 961
}

TEST_F(HighlightingMarks, TypeDefDeclaration)
{
962
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(418, 36));
963

964
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
965 966 967 968
}

TEST_F(HighlightingMarks, TypeDefDeclarationUsage)
{
969
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(419, 48));
970

971
    ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
972 973
}

974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
TEST_F(HighlightingMarks, NonConstReferenceArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(455, 35));

    infos[1];

    ASSERT_THAT(infos[2],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

TEST_F(HighlightingMarks, ConstReferenceArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(464, 32));

    infos[1];

    ASSERT_THAT(infos[2],
                HasOnlyType(HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, RValueReferenceArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(473, 52));

    infos[1];

    ASSERT_THAT(infos[8],
                HasOnlyType(HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, NonConstPointerArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(482, 33));

    infos[1];

    ASSERT_THAT(infos[2],
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
                HasOnlyType(HighlightingType::LocalVariable));
}

TEST_F(HighlightingMarks, PointerToConstArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(490, 31));

    infos[1];

    ASSERT_THAT(infos[2],
                HasOnlyType(HighlightingType::LocalVariable));
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
}

TEST_F(HighlightingMarks, ConstPointerArgument)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(491, 30));

    infos[1];

    ASSERT_THAT(infos[2],
                HasOnlyType(HighlightingType::LocalVariable));
}

1034 1035
TEST_F(HighlightingMarks, NonConstPointerGetterAsArgument)
{
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(580, 42));

    infos[1];

    ASSERT_THAT(infos[2] ,HasMixin(HighlightingType::OutputArgument));
    ASSERT_THAT(infos[3], HasMixin(HighlightingType::OutputArgument));
    ASSERT_THAT(infos[4], HasMixin(HighlightingType::OutputArgument));
    ASSERT_THAT(infos[5], HasMixin(HighlightingType::OutputArgument));
    ASSERT_THAT(infos[6], HasMixin(HighlightingType::OutputArgument));
    ASSERT_THAT(infos[7], Not(HasMixin(HighlightingType::OutputArgument)));
1046 1047
}

1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
TEST_F(HighlightingMarks, NonConstReferenceArgumentCallInsideCall)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(501, 64));
    infos[1];

    infos[3];

    ASSERT_THAT(infos[7],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

TEST_F(HighlightingMarks, OutputArgumentsAreEmptyAfterIteration)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(501, 63));

Marco Bubke's avatar
Marco Bubke committed
1063
    for (const auto &info : infos ) { Q_UNUSED(info) }
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084

    ASSERT_TRUE(infos.currentOutputArgumentRangesAreEmpty());
}

TEST_F(HighlightingMarks, NonConstReferenceArgumentFromFunctionParameter)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(506, 42));

    infos[1];

    ASSERT_THAT(infos[2],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

TEST_F(HighlightingMarks, NonConstPointerArgumentAsExpression)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(513, 33));

    infos[1];

    ASSERT_THAT(infos[3],
1085
                HasOnlyType(HighlightingType::LocalVariable));
1086 1087
}

1088
TEST_F(HighlightingMarks, NonConstPointerArgumentAsInstanceWithMember)
1089 1090 1091 1092 1093
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(525, 46));

    infos[1];

1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
    ASSERT_THAT(infos[2],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

TEST_F(HighlightingMarks, NonConstPointerArgumentAsMemberOfInstance)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(525, 46));

    infos[1];
    infos[2];

1105 1106 1107 1108
    ASSERT_THAT(infos[4],
                HasTwoTypes(HighlightingType::Field, HighlightingType::OutputArgument));
}

1109 1110 1111 1112 1113 1114 1115 1116 1117 1118
TEST_F(HighlightingMarks, DISABLED_NonConstReferenceArgumentConstructor)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(540, 57));

    infos[2];

    ASSERT_THAT(infos[3],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
TEST_F(HighlightingMarks, DISABLED_NonConstReferenceMemberInitialization)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(546, 19));

    infos[2];

    ASSERT_THAT(infos[3],
                HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
}

1129
TEST_F(HighlightingMarks, EnumerationTypeDef)
1130
{
1131
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(424, 41));
1132

1133
    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
1134 1135 1136 1137 1138
}

// QTCREATORBUG-15473
TEST_F(HighlightingMarks, DISABLED_ArgumentToUserDefinedIndexOperator)
{
1139
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(434, 19));
1140

1141
    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::LocalVariable));
1142 1143
}

1144 1145 1146 1147 1148 1149 1150
TEST_F(HighlightingMarks, ClassTemplateParticalSpecialization)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(553, 33));

    ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Type));
}

1151 1152 1153 1154 1155 1156 1157
TEST_F(HighlightingMarks, UsingFunction)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(556, 27));

    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Function));
}

1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171
TEST_F(HighlightingMarks, PreprocessorIfDirective)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(558, 6));

    ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
}

TEST_F(HighlightingMarks, PreprocessorInclusionDirectiveWithKeyword)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(561, 15));

    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::StringLiteral));
}

1172
// CLANG-UPGRADE-CHECK: Enable once https://bugs.llvm.org//show_bug.cgi?id=12972 is resolved.
1173 1174 1175 1176 1177 1178 1179
TEST_F(HighlightingMarks, DISABLED_VariableInOperatorFunctionCall)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(566, 12));

    ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::LocalVariable));
}

1180 1181 1182 1183 1184 1185 1186
TEST_F(HighlightingMarks, UsingTemplateFunction)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(584, 17));

    ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Function));
}

1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222
TEST_F(HighlightingMarks, HeaderNameIsInclusion)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(239, 31));
    ClangBackEnd::HighlightingMarkContainer container(infos[2]);
    ASSERT_THAT(container.isIncludeDirectivePath(), true);
}

TEST_F(HighlightingMarks, HeaderNameIsInclusionWithAngleBrackets)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(289, 31));
    ClangBackEnd::HighlightingMarkContainer container(infos[2]);
    ASSERT_THAT(container.isIncludeDirectivePath(), true);
}


TEST_F(HighlightingMarks, NotInclusion)
{
    const auto infos = translationUnit.highlightingMarksInRange(sourceRange(241, 13));