File indexing completed on 2024-05-12 04:39:28

0001 /*
0002     SPDX-FileCopyrightText: 2012 Miha Čančula <miha@noughmad.eu>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef CTESTSUITE_H
0008 #define CTESTSUITE_H
0009 
0010 #include <interfaces/itestsuite.h>
0011 #include <language/duchain/indexeddeclaration.h>
0012 #include <util/path.h>
0013 #include <QHash>
0014 #include <QPointer>
0015 
0016 namespace KDevelop {
0017 class ReferencedTopDUContext;
0018 class Declaration;
0019 }
0020 
0021 class CTestSuite : public KDevelop::ITestSuite
0022 {
0023 public:
0024     CTestSuite(const QString& name, const KDevelop::Path &executable, const QList<KDevelop::Path>& files, KDevelop::IProject* project, const QStringList& args, const QHash<QString, QString>& properties);
0025     ~CTestSuite() override;
0026 
0027     KJob* launchCase(const QString& testCase, TestJobVerbosity verbosity) override;
0028     KJob* launchCases(const QStringList& testCases, TestJobVerbosity verbosity) override;
0029     KJob* launchAllCases(TestJobVerbosity verbosity) override;
0030 
0031     virtual KDevelop::Path executable() const;
0032     QStringList cases() const override;
0033     QString name() const override;
0034     KDevelop::IProject* project() const override;
0035 
0036     KDevelop::IndexedDeclaration declaration() const override;
0037     KDevelop::IndexedDeclaration caseDeclaration(const QString& testCase) const override;
0038 
0039     virtual QHash<QString, QString> properties() const;
0040 
0041     QStringList arguments() const;
0042     void setTestCases(const QStringList& cases);
0043     QList<KDevelop::Path> sourceFiles() const;
0044     void loadDeclarations(const KDevelop::IndexedString& document, const KDevelop::ReferencedTopDUContext& context);
0045 
0046 private:
0047     bool findCaseDeclarations(const QVector<KDevelop::Declaration*> &classDeclarations);
0048 
0049     KDevelop::Path m_executable;
0050     QString m_name;
0051     QStringList m_cases;
0052     QStringList m_args;
0053     QList<KDevelop::Path> m_files;
0054     QPointer<KDevelop::IProject> m_project;
0055 
0056     QHash<QString, KDevelop::IndexedDeclaration> m_declarations;
0057     QHash<QString, QString> m_properties;
0058     KDevelop::IndexedDeclaration m_suiteDeclaration;
0059 };
0060 
0061 #endif // CTESTSUITE_H