blob: 4bebb16bce84173a1f786effd0296229bcf0bba2 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "catchtreeitem.h"
#include <cplusplus/SimpleLexer.h>
#include <QByteArray>
namespace Autotest {
namespace Internal {
class CatchCodeParser
{
public:
CatchCodeParser(const QByteArray &source, const CPlusPlus::LanguageFeatures &features);
virtual ~CatchCodeParser() = default;
CatchTestCodeLocationList findTests();
private:
void handleIdentifier();
void handleTestCase(bool isScenario);
void handleParameterizedTestCase(bool isFixture);
void handleFixtureOrRegisteredTestCase(bool isFixture, bool isScenario);
QString getStringLiteral(CPlusPlus::Kind &stoppedAtKind);
bool skipCommentsUntil(CPlusPlus::Kind nextExpectedKind); // moves currentIndex if succeeds
CPlusPlus::Kind skipUntilCorrespondingRParen(); // moves currentIndex
bool skipParameter();
const QByteArray &m_source;
const CPlusPlus::LanguageFeatures &m_features;
CPlusPlus::Tokens m_tokens;
int m_currentIndex = 0;
CatchTestCodeLocationList m_testCases;
};
} // namespace Internal
} // namespace Autotest
|