| 42 | } |
| 43 | |
| 44 | void TestCppcheckJob::testJob() |
| 45 | { |
| 46 | QStringList stdoutOutput = { |
| 47 | "Checking source1.cpp...", |
| 48 | "1/2 files checked 50% done", |
| 49 | "Checking source2.cpp...", |
| 50 | "2/2 files checked 50% done" |
| 51 | }; |
| 52 | |
| 53 | QStringList stderrOutput = { |
| 54 | "(information) Couldn't find path given by -I '/missing_include_dir_1/'", |
| 55 | "(information) Couldn't find path given by -I '/missing_include_dir_2/'", |
| 56 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", |
| 57 | "<results version=\"2\">", |
| 58 | " <cppcheck version=\"1.72\"/>", |
| 59 | " <errors>", |
| 60 | " <error id=\"missingInclude\" severity=\"information\" msg=\"msg...\" verbose=\"verbose...\"/>", |
| 61 | " </errors>", |
| 62 | "</results>" |
| 63 | }; |
| 64 | |
| 65 | Parameters jobParams; |
| 66 | JobTester jobTester(jobParams); |
| 67 | |
| 68 | jobTester.postProcessStderr(stderrOutput); |
| 69 | jobTester.postProcessStdout(stdoutOutput); |
| 70 | |
| 71 | // move non-XML elements from stderrOutput |
| 72 | stdoutOutput.push_front(stderrOutput[1]); |
| 73 | stdoutOutput.push_front(stderrOutput[0]); |
| 74 | stderrOutput.pop_front(); |
| 75 | stderrOutput.pop_front(); |
| 76 | |
| 77 | QCOMPARE(jobTester.standardOutput(), stdoutOutput.join('\n')); |
| 78 | QCOMPARE(jobTester.xmlOutput(), stderrOutput.join('\n')); |
| 79 | } |
| 80 | |
| 81 | QTEST_GUILESS_MAIN(TestCppcheckJob) |
| 82 |
nothing calls this directly
no test coverage detected