1
/* KDevelop CMake Support
3
* Copyright 2007 Aleix Pol Gonzalez <aleixpol@gmail.com>
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
#include "cmakecompliance.h"
23
#include "cmakeprojectvisitor.h"
24
#include "astfactory.h"
29
#include <KStandardDirs>
31
QTEST_MAIN( CMakeCompliance )
33
//Copied from CMakeManager
34
QString executeProcess(const QString& execName, const QStringList& args=QStringList())
37
p.setOutputChannelMode(KProcess::MergedChannels);
38
p.setProgram(execName, args);
41
if(!p.waitForFinished())
43
kDebug(9032) << "failed to execute:" << execName;
46
QByteArray b = p.readAllStandardOutput();
48
t.prepend(b.trimmed());
53
void CMakeCompliance::testEnumerate()
55
QFETCH( QString, exe);
57
QStringList commands=executeProcess(exe, QStringList("--help-command-list")).split("\n");
58
commands.erase(commands.begin());
60
foreach(const QString& cmd, commands)
62
if(cmd.toLower().startsWith("end") || cmd.toLower()=="else" || cmd.toLower()=="elseif")
64
CMakeAst* element = AstFactory::self()->createAst(cmd);
66
qDebug() << cmd << "is not supported";
71
void CMakeCompliance::testEnumerate_data()
73
QTest::addColumn<QString>( "exe" );
75
KStandardDirs::findAllExe(cmakes, "cmake");
77
foreach(const QString& path, cmakes)
79
QTest::newRow( qPrintable(path) ) << (path);
83
#include "cmakecompliance.moc"