[shellprocess] Test command-substitution

This commit is contained in:
Adriaan de Groot 2018-05-16 11:36:59 -04:00
parent b5d900c1c6
commit 8b00a03423
2 changed files with 15 additions and 0 deletions

View File

@ -149,3 +149,16 @@ script:
QCOMPARE( cl.at(0).command(), QStringLiteral( "ls /tmp" ) );
QCOMPARE( cl.at(1).timeout(), -1 ); // not set
}
void ShellProcessTests::testRootSubstitution()
{
YAML::Node doc = YAML::Load( R"(---
script:
- "ls /tmp"
)" );
QVariant script = CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" );
// Doesn't use @@ROOT@@, so no failures
QVERIFY( bool(CommandList(script, true, 10 ).run()) );
QVERIFY( bool(CommandList(script, false, 10 ).run()) );
}

View File

@ -40,6 +40,8 @@ private Q_SLOTS:
void testProcessFromObject();
// Create from a complex YAML list
void testProcessListFromObject();
// Check @@ROOT@@ substitution
void testRootSubstitution();
};
#endif