File indexing completed on 2024-09-08 12:21:28
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2001, 2003 Peter Kelly <pmk@post.com> 0004 SPDX-FileCopyrightText: 2003, 2004 Stephan Kulow <coolo@kde.org> 0005 SPDX-FileCopyrightText: 2004 Dirk Mueller <mueller@kde.org> 0006 SPDX-FileCopyrightText: 2006, 2007 Leo Savernik <l.savernik@aon.at> 0007 SPDX-FileCopyrightText: 2010 Milian Wolff <mail@milianw.de> 0008 SPDX-FileCopyrightText: 2013 Gerald Senarclens de Grancy <oss@senarclens.eu> 0009 0010 SPDX-License-Identifier: LGPL-2.0-or-later 0011 */ 0012 0013 // BEGIN Includes 0014 #include "indenttest.h" 0015 0016 #include "kateconfig.h" 0017 #include "katedocument.h" 0018 0019 #include <QtTestWidgets> 0020 0021 #include "testutils.h" 0022 0023 QTEST_MAIN(IndentTest) 0024 0025 #define FAILURE(test, comment) qMakePair<const char *, const char *>((test), (comment)) 0026 0027 void IndentTest::initTestCase() 0028 { 0029 ScriptTestBase::initTestCase(); 0030 m_document->config()->setValue(KateDocumentConfig::IndentOnTextPaste, true); 0031 m_section = "indent"; 0032 m_script_dir = "indentation"; 0033 } 0034 0035 void IndentTest::testCstyle_data() 0036 { 0037 getTestData("cstyle"); 0038 } 0039 0040 void IndentTest::testCstyle() 0041 { 0042 runTest( 0043 ExpectedFailures() << FAILURE("using1", "this is insane, those who write such code can cope with it :P") 0044 << FAILURE("using2", "this is insane, those who write such code can cope with it :P") 0045 << FAILURE("plist14", 0046 "in function signatures it might be wanted to use the indentation of the\n" 0047 "opening paren instead of just increasing the indentation level like in function calls") 0048 << FAILURE("switch10", "test for case where cfgSwitchIndent = false; needs proper config-interface") 0049 << FAILURE("switch11", "test for case where cfgSwitchIndent = false; needs proper config-interface") 0050 << FAILURE("visib2", "test for access modifier where cfgAccessModifiers = 1;needs proper config interface") 0051 << FAILURE("visib3", "test for access modifier where cfgAccessModifiers = 1;needs proper config interface") 0052 << FAILURE("plist10", "low low prio, maybe wontfix: if the user wants to add a arg, he should do so and press enter afterwards") 0053 << FAILURE("switch13", "pure insanity, whoever wrote this test and expects that to be indented properly should stop writing code")); 0054 } 0055 0056 void IndentTest::testCppstyle_data() 0057 { 0058 getTestData("cppstyle"); 0059 } 0060 0061 void IndentTest::testCppstyle() 0062 { 0063 runTest(ExpectedFailures() 0064 /// \todo Fix (smth) to make failed test cases really work! 0065 << FAILURE("parens1", "dunno why it failed in test! in manual mode everything works fine...")); 0066 } 0067 0068 void IndentTest::testCMake_data() 0069 { 0070 getTestData("cmake"); 0071 } 0072 0073 void IndentTest::testCMake() 0074 { 0075 runTest(ExpectedFailures()); 0076 } 0077 0078 void IndentTest::testPython_data() 0079 { 0080 getTestData("python"); 0081 } 0082 0083 void IndentTest::testPython() 0084 { 0085 runTest(ExpectedFailures()); 0086 } 0087 0088 void IndentTest::testJulia_data() 0089 { 0090 getTestData("julia"); 0091 } 0092 0093 void IndentTest::testJulia() 0094 { 0095 runTest(ExpectedFailures()); 0096 } 0097 0098 void IndentTest::testHaskell_data() 0099 { 0100 getTestData("haskell"); 0101 } 0102 0103 void IndentTest::testHaskell() 0104 { 0105 runTest(ExpectedFailures()); 0106 } 0107 0108 void IndentTest::testLatex_data() 0109 { 0110 getTestData("latex"); 0111 } 0112 0113 void IndentTest::testLatex() 0114 { 0115 runTest(ExpectedFailures()); 0116 } 0117 0118 void IndentTest::testPascal_data() 0119 { 0120 getTestData("pascal"); 0121 } 0122 0123 void IndentTest::testPascal() 0124 { 0125 runTest(ExpectedFailures()); 0126 } 0127 0128 void IndentTest::testAda_data() 0129 { 0130 getTestData("ada"); 0131 } 0132 0133 void IndentTest::testAda() 0134 { 0135 runTest(ExpectedFailures()); 0136 } 0137 0138 void IndentTest::testRuby_data() 0139 { 0140 getTestData("ruby"); 0141 } 0142 0143 void IndentTest::testRuby() 0144 { 0145 runTest(ExpectedFailures() << FAILURE("block01", "Multiline blocks using {} is not supported") 0146 << FAILURE("block02", "Multiline blocks using {} is not supported") 0147 << FAILURE("singleline01", "Single line defs are not supported") << FAILURE("singleline02", "Single line defs are not supported") 0148 << FAILURE("wordlist01", "multiline word list is not supported") << FAILURE("wordlist02", "multiline word list is not supported") 0149 << FAILURE("wordlist11", "multiline word list is not supported") << FAILURE("wordlist12", "multiline word list is not supported") 0150 << FAILURE("wordlist21", "multiline word list is not supported") << FAILURE("wordlist22", "multiline word list is not supported") 0151 << FAILURE("if20", "multi line if assignment is not supported") << FAILURE("if21", "multi line if assignment is not supported") 0152 << FAILURE("if30", "single line if is not supported") << FAILURE("if31", "single line if is not supported") 0153 << FAILURE("regexp1", "regression, inside already in commit afc551d14225023ce38900ddc49b43ba2a0762a8")); 0154 } 0155 0156 void IndentTest::testXml_data() 0157 { 0158 getTestData("xml"); 0159 } 0160 0161 void IndentTest::testXml() 0162 { 0163 runTest(ExpectedFailures()); 0164 } 0165 0166 void IndentTest::testNormal_data() 0167 { 0168 getTestData("normal"); 0169 } 0170 0171 void IndentTest::testNormal() 0172 { 0173 runTest(ExpectedFailures()); 0174 } 0175 0176 void IndentTest::testReplicode_data() 0177 { 0178 getTestData("replicode"); 0179 } 0180 0181 void IndentTest::testReplicode() 0182 { 0183 runTest(ExpectedFailures()); 0184 } 0185 0186 void IndentTest::testR_data() 0187 { 0188 getTestData("R"); 0189 } 0190 0191 void IndentTest::testR() 0192 { 0193 runTest(ExpectedFailures()); 0194 } 0195 0196 #include "moc_indenttest.cpp"