[libcalamares] Expand tests for runCommand

- try both with and without a working-directory set, this would have
   shown up the problem with bad indentation much earlier.
This commit is contained in:
Adriaan de Groot 2019-06-07 16:00:37 +02:00
parent 7be33b8196
commit 4e13f780f1

View File

@ -132,5 +132,29 @@ LibCalamaresTests::testCommands()
QVERIFY( tf.open() );
QVERIFY( !tf.fileName().isEmpty() );
QVERIFY( r.getOutput().contains( tf.fileName() ) );
QFileInfo tfn( tf.fileName() );
QVERIFY( !r.getOutput().contains( tfn.fileName() ) );
// Run ls again, now that the file exists
r = System::runCommand(
System::RunLocation::RunInHost,
{ "/bin/ls", "/tmp" }
);
QVERIFY( r.getOutput().contains( tfn.fileName() ) );
// .. and without a working directory set, assume builddir != /tmp
r = System::runCommand(
System::RunLocation::RunInHost,
{ "/bin/ls" }
);
QVERIFY( !r.getOutput().contains( tfn.fileName() ) );
r = System::runCommand(
System::RunLocation::RunInHost,
{ "/bin/ls" },
"/tmp"
);
QVERIFY( r.getOutput().contains( tfn.fileName() ) );
}