Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/tests/test_ctestfindsuites.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 63 | { | |||
---|---|---|---|---|---|
67 | QVERIFY(ICore::self()->projectController()->projects().isEmpty()); | 67 | QVERIFY(ICore::self()->projectController()->projects().isEmpty()); | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | void TestCTestFindSuites::cleanupTestCase() | 70 | void TestCTestFindSuites::cleanupTestCase() | ||
71 | { | 71 | { | ||
72 | TestCore::shutdown(); | 72 | TestCore::shutdown(); | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | void TestCTestFindSuites::testCTestSuite() | 75 | void TestCTestFindSuites::testCTestSuite() | ||
kfunk: Note: This should probably be turned into a data-driven test in future. Too many branches… | |||||
76 | { | 76 | { | ||
77 | IProject* project = loadProject( "unit_tests" ); | 77 | IProject* project = loadProject( "unit_tests" ); | ||
78 | QVERIFY2(project, "Project was not opened"); | 78 | QVERIFY2(project, "Project was not opened"); | ||
79 | waitForSuites(project, 5, 10); | 79 | waitForSuites(project, 5, 10); | ||
80 | QList<ITestSuite*> suites = ICore::self()->testController()->testSuitesForProject(project); | 80 | QList<ITestSuite*> suites = ICore::self()->testController()->testSuitesForProject(project); | ||
81 | 81 | | |||
82 | QCOMPARE(suites.size(), 5); | 82 | QCOMPARE(suites.size(), 5); | ||
83 | 83 | | |||
84 | DUChainReadLocker locker(DUChain::lock()); | 84 | DUChainReadLocker locker(DUChain::lock()); | ||
85 | 85 | | |||
86 | foreach (auto suite, suites) | 86 | foreach (auto suite, suites) | ||
87 | { | 87 | { | ||
88 | QCOMPARE(suite->cases(), QStringList()); | 88 | QCOMPARE(suite->cases(), QStringList()); | ||
89 | QVERIFY(!suite->declaration().isValid()); | 89 | QVERIFY(!suite->declaration().isValid()); | ||
90 | CTestSuite* ctestSuite = (CTestSuite*)(suite); | 90 | CTestSuite* ctestSuite = static_cast<CTestSuite*>(suite); | ||
91 | const auto buildDir = Path(CMake::allBuildDirs(project).at(0)); | 91 | const auto buildDir = Path(CMake::allBuildDirs(project).at(0)); | ||
92 | QString exeSubdir = buildDir.relativePath(ctestSuite->executable().parent()); | 92 | QString exeSubdir = buildDir.relativePath(ctestSuite->executable().parent()); | ||
93 | QCOMPARE(exeSubdir, ctestSuite->name() == "fail" ? QStringLiteral("bin") : QString() ); | 93 | QCOMPARE(exeSubdir, ctestSuite->name() == "fail" ? QStringLiteral("bin") : QString() ); | ||
94 | QVERIFY(ctestSuite->properties().isEmpty()); | ||||
94 | } | 95 | } | ||
95 | } | 96 | } | ||
96 | 97 | | |||
97 | QTEST_MAIN(TestCTestFindSuites) | 98 | QTEST_MAIN(TestCTestFindSuites) |
Note: This should probably be turned into a data-driven test in future. Too many branches checking for individual test rows in the body now.