~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to projectmanagers/cmake/tests/cmakeadddefinitionasttest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* KDevelop CMake Support
 
2
 *
 
3
 * Copyright 2006 Matt Rogers <mattr@kde.org>
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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
 
18
 * 02110-1301, USA.
 
19
 */
 
20
 
 
21
#include "cmakeadddefinitionasttest.h"
 
22
#include "cmakeast.h"
 
23
#include "cmakelistsparser.h"
 
24
 
 
25
QTEST_MAIN( AddDefinitionsAstTest )
 
26
 
 
27
void AddDefinitionsAstTest::testGoodParse()
 
28
{
 
29
    QFETCH( CMakeFunctionDesc, function );
 
30
    AddDefinitionsAst* ast = new AddDefinitionsAst();
 
31
    QVERIFY( ast->parseFunctionInfo( function ) == true );
 
32
    delete ast;
 
33
}
 
34
 
 
35
void AddDefinitionsAstTest::testGoodParse_data()
 
36
{
 
37
    CMakeFunctionDesc func;
 
38
    func.name = "add_definitions";
 
39
    QStringList argList;
 
40
    argList << "-DFOOBAR" << "-DQT_NO_STL";
 
41
    func.addArguments( argList );
 
42
 
 
43
    QTest::addColumn<CMakeFunctionDesc>( "function" );
 
44
    QTest::newRow( "simple" ) << func;
 
45
}
 
46
 
 
47
void AddDefinitionsAstTest::testBadParse_data()
 
48
{
 
49
    CMakeFunctionDesc func;
 
50
    func.name = "add_definition";
 
51
    QStringList argList;
 
52
    argList << "-DFOOBAR" << "-DQT_NO_STL";
 
53
    func.addArguments( argList );
 
54
 
 
55
    QTest::addColumn<CMakeFunctionDesc>( "function" );
 
56
    QTest::newRow( "simple - bad" ) << func;
 
57
 
 
58
}
 
59
 
 
60
void AddDefinitionsAstTest::testBadParse()
 
61
{
 
62
    QFETCH( CMakeFunctionDesc, function );
 
63
    AddDefinitionsAst* ast = new AddDefinitionsAst();
 
64
    QVERIFY( ast->parseFunctionInfo( function ) == false );
 
65
    delete ast;
 
66
}
 
67
 
 
68
#include "cmakeadddefinitionasttest.moc"
 
69