-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nvim-qt --help/version should work without $DISPLAY
The intent is to split command line handling from the App instance, so that we can do it using a QCoreApplication and QCommandLineParser. To achieve this i made multiple functions in the App class static. Added a small test for #707 i.e. the following CLI invocations should work without a $DISPLAY variable: --version --help I've left --help-all out of this, since I cant get it to behave reliably.
- Loading branch information
equalsraf
committed
Jun 20, 2020
1 parent
f561863
commit fab5ba3
Showing
5 changed files
with
93 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <QtGlobal> | ||
#include <QProcess> | ||
#include <QtTest/QtTest> | ||
|
||
namespace NeovimQt { | ||
|
||
class Test: public QObject | ||
{ | ||
Q_OBJECT | ||
private slots: | ||
|
||
void runsWithoutDISPLAY_data() { | ||
QTest::addColumn<QStringList>("arguments"); | ||
QTest::addColumn<int>("expected_exitcode"); | ||
|
||
QTest::newRow("--help") << QStringList({NVIM_QT_BINARY, "--help"}) << 0; | ||
QTest::newRow("--version") << QStringList({NVIM_QT_BINARY, "--help"}) << 0; | ||
} | ||
|
||
void runsWithoutDISPLAY() { | ||
QFETCH(QStringList, arguments); | ||
QFETCH(int, expected_exitcode); | ||
|
||
QProcess p; | ||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | ||
env.remove("DISPLAY"); | ||
p.setProcessEnvironment(env); | ||
p.setProgram(NVIM_QT_BINARY); | ||
p.setArguments(arguments); | ||
p.start(); | ||
bool finished = p.waitForFinished(); | ||
auto status = p.exitStatus(); | ||
int exit_code = p.exitCode(); | ||
|
||
qDebug() << finished << status << exit_code; | ||
QCOMPARE(finished, true); | ||
QCOMPARE(status, QProcess::NormalExit); | ||
QCOMPARE(exit_code, expected_exitcode); | ||
} | ||
|
||
protected: | ||
}; | ||
|
||
} // Namespace NeovimQt | ||
QTEST_MAIN(NeovimQt::Test) | ||
#include "tst_main.moc" |