Changeset View
Changeset View
Standalone View
Standalone View
autotests/htmlhighlighter_test.cpp
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 84 | { | |||
---|---|---|---|---|---|
95 | auto def = m_repo->definitionForFileName(inFile); | 95 | auto def = m_repo->definitionForFileName(inFile); | ||
96 | if (!syntax.isEmpty()) | 96 | if (!syntax.isEmpty()) | ||
97 | def = m_repo->definitionForName(syntax); | 97 | def = m_repo->definitionForName(syntax); | ||
98 | QVERIFY(def.isValid()); | 98 | QVERIFY(def.isValid()); | ||
99 | highlighter.setDefinition(def); | 99 | highlighter.setDefinition(def); | ||
100 | highlighter.setOutputFile(outFile); | 100 | highlighter.setOutputFile(outFile); | ||
101 | highlighter.highlightFile(inFile); | 101 | highlighter.highlightFile(inFile); | ||
102 | 102 | | |||
103 | auto args = QStringList() << QStringLiteral("-u") << refFile << outFile; | 103 | const auto diffExecutable = QStandardPaths::findExecutable(QStringLiteral("diff")); | ||
104 | if (!diffExecutable.isEmpty()) { | ||||
104 | QProcess proc; | 105 | QProcess proc; | ||
105 | proc.setProcessChannelMode(QProcess::ForwardedChannels); | 106 | proc.setProcessChannelMode(QProcess::ForwardedChannels); | ||
106 | proc.start(QStringLiteral("diff"), args); | 107 | proc.start(diffExecutable, {QStringLiteral("-u"), refFile, outFile}); | ||
107 | QVERIFY(proc.waitForFinished()); | 108 | QVERIFY(proc.waitForFinished()); | ||
108 | QCOMPARE(proc.exitCode(), 0); | 109 | QCOMPARE(proc.exitCode(), 0); | ||
110 | } else { | ||||
111 | qDebug() << "Skipping part of the test since the 'diff' executable is not in PATH"; | ||||
112 | } | ||||
109 | } | 113 | } | ||
110 | 114 | | |||
111 | }; | 115 | }; | ||
112 | 116 | | |||
113 | QTEST_GUILESS_MAIN(HTMLHighlighterTest) | 117 | QTEST_GUILESS_MAIN(HTMLHighlighterTest) | ||
114 | 118 | | |||
115 | #include "htmlhighlighter_test.moc" | 119 | #include "htmlhighlighter_test.moc" | ||
116 | 120 | |