diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
commit | 7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f (patch) | |
tree | c76702a7f6310fbe9d437e347535422e836e94e9 /tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp | |
parent | a2a38be7600e2a2c2b49c66902d912ca036a2c0f (diff) | |
parent | 27bbee9a5f9dcda53d8eb23863ee670ad1360e41 (diff) | |
download | tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.tar.gz tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp')
-rw-r--r-- | tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp b/tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp new file mode 100644 index 000000000..e5bb3dcea --- /dev/null +++ b/tdecore/tdeconfig_compiler/tests/tdeconfigcompiler_test.cpp @@ -0,0 +1,96 @@ +/* + Tests for TDEConfig Compiler + + Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org> + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include <tqfile.h> +#include <tqstring.h> +#include <kdebug.h> +#include <tdeunittest/module.h> +#include "tdeconfigcompiler_test.h" + +using namespace KUnitTest; + +KUNITTEST_MODULE( tdeunittest_tdeconfigcompiler_test, "TDEConfigXT") +KUNITTEST_MODULE_REGISTER_TESTER( TDEConfigCompiler_Test ) + +typedef const char * CompilerTestSet[]; + +static CompilerTestSet testCases = +{ + "test1.cpp", "test1.h", + "test2.cpp", "test2.h", + "test3.cpp", "test3.h", + "test4.cpp", "test4.h", + "test5.cpp", "test5.h", + "test6.cpp", "test6.h", + "test7.cpp", "test7.h", + "test8a.cpp", "test8a.h", + "test8b.cpp", "test8b.h", + "test9.h", "test9.cpp", + "test_dpointer.cpp", "test_dpointer.h", + NULL +}; + +static CompilerTestSet willFailCases = +{ + // where is that TQDir comming from? + //"test9.cpp", NULL + NULL +}; + + +void TDEConfigCompiler_Test::allTests() +{ + testExpectedOutput(); +} + +void TDEConfigCompiler_Test::testExpectedOutput() +{ + uint i = 0; + // Known to pass test cases + while (testCases[ i ]) + { + performCompare(TQString::fromLatin1(testCases[ i ])); + ++i; + } + + // broken test cases + i= 0; + while (willFailCases[ i ]) + { + performCompare(TQString::fromLatin1(willFailCases[ i ]), true); + ++i; + } +} + +void TDEConfigCompiler_Test::performCompare(const TQString &fileName, bool fail) +{ + TQFile file(fileName); + TQFile fileRef(TQString::fromLatin1(SRCDIR) + TQString::fromLatin1("/") + fileName + TQString::fromLatin1(".ref")); + + if ( file.open(IO_ReadOnly) && fileRef.open(IO_ReadOnly) ) + { + TQString content = file.readAll(); + TQString contentRef = fileRef.readAll(); + + if (!fail) + CHECK( content, contentRef); + else + XFAIL( content, contentRef); + } + else + { + SKIP("Can't open file for comparision"); + } +} |