File indexing completed on 2024-05-19 04:39:59

0001 /*
0002     SPDX-FileCopyrightText: 2016 Anton Anikin <anton.anikin@htower.ru>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QScopedPointer>
0011 #include <QVector>
0012 
0013 class QTemporaryDir;
0014 
0015 namespace KDevelop {
0016 
0017 struct Source
0018 {
0019     QString path;
0020     QStringList lines;
0021 };
0022 
0023 class TestKdevFormatSource : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     TestKdevFormatSource();
0029     ~TestKdevFormatSource() override;
0030 
0031 private Q_SLOTS:
0032     void initTestCase();
0033 
0034     void testNotFound();
0035     void testNotFound_data();
0036 
0037     void testNoCommands();
0038     void testNoCommands_data();
0039 
0040     void testNotMatch();
0041     void testNotMatch_data();
0042 
0043     void testMatch1();
0044     void testMatch1_data();
0045 
0046     void testMatch2();
0047     void testMatch2_data();
0048 
0049     void testWildcardPathMatching();
0050     void testWildcardPathMatching_data();
0051 
0052 private:
0053     bool initTest(const QStringList& formatFileData);
0054     void runTest() const;
0055 
0056     bool mkPath(const QString& path) const;
0057     bool writeLines(const QString& path, const QStringList& lines) const;
0058     bool readLines(const QString& path, QStringList& lines) const;
0059 
0060     QScopedPointer<QTemporaryDir> m_temporaryDir;
0061     QVector<Source> m_sources;
0062 };
0063 
0064 }