1
/* KDevelop CMake Support
3
* Copyright 2006 Matt Rogers <mattr@kde.org>
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 "cmakecustomtargetasttest.h"
23
#include "cmakelistsparser.h"
25
QTEST_MAIN( CustomTargetAstTests )
27
void CustomTargetAstTests::testGoodParse()
29
QFETCH( CMakeFunctionDesc, function );
30
CustomTargetAst* ast = new CustomTargetAst();
31
QVERIFY( ast->parseFunctionInfo( function ) == true );
35
void CustomTargetAstTests::testGoodParse_data()
37
CMakeFunctionDesc func1;
38
func1.name = "add_custom_target";
40
argList1 << "MyName" << "ALL" << "foobar --test" << "COMMAND"
41
<< "barbaz --foo" << "DEPENDS" << "dep1" << "dep2" << "dep3"
42
<< "WORKING_DIRECTORY" << "/path/to/my/dir" << "COMMENT"
43
<< "this is my comment" << "VERBATIM";
44
func1.addArguments( argList1 );
46
CMakeFunctionDesc func2;
47
func2.name = "ADD_CUSTOM_TARGET";
49
argList2 << "MyName" << "my_command --test-param 1";
50
func2.addArguments( argList2 );
52
QTest::addColumn<CMakeFunctionDesc>( "function" );
53
QTest::newRow( "all optional" ) << func1;
54
QTest::newRow( "no optional" ) << func2;
57
void CustomTargetAstTests::testBadParse()
59
QFETCH( CMakeFunctionDesc, function );
60
CustomTargetAst* ast = new CustomTargetAst();
61
QVERIFY( ast->parseFunctionInfo( function ) == false );
65
void CustomTargetAstTests::testBadParse_data()
67
CMakeFunctionDesc func1;
68
func1.name = "add_custom_target";
70
argList1 << "IAm#1" << "ALL" << "foobar --test" << "COMMAND"
71
<< "barbaz --foo" << "DEPENDS" << "dep1" << "dep2" << "dep3"
72
<< "WORKING_DIRECTORY" << "/path/to/my/dir" << "COMMENT"
73
<< "this is my comment" << "VERBATIM";
74
func1.addArguments( argList1 );
76
CMakeFunctionDesc func2;
77
func2.name = "ADD_CUSTOM_TARGET";
79
argList2 << "ALL" << "my_command --test-param 1";
80
func2.addArguments( argList2 );
82
CMakeFunctionDesc func3;
83
func3.name = "add_custom_target";
85
QTest::addColumn<CMakeFunctionDesc>( "function" );
86
QTest::newRow( "bad 1" ) << func1;
87
QTest::newRow( "bad 2" ) << func2;
88
QTest::newRow( "bad 3" ) << func3;
91
#include "cmakecustomtargetasttest.moc"