[shellprocess] Add test for future feature
- proposed syntax for command+timeout configuration, both for single- entry and for lists. - test it already
This commit is contained in:
parent
fe2be46d3f
commit
4917b5c778
@ -113,3 +113,30 @@ script: false
|
||||
QCOMPARE( cl1.count(), 0 );
|
||||
|
||||
}
|
||||
|
||||
void ShellProcessTests::testProcessFromObject()
|
||||
{
|
||||
YAML::Node doc = YAML::Load( R"(---
|
||||
script:
|
||||
command: "ls /tmp"
|
||||
timeout: 20
|
||||
)" );
|
||||
CommandList cl(
|
||||
CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" ) );
|
||||
QVERIFY( !cl.isEmpty() );
|
||||
QCOMPARE( cl.count(), 1 );
|
||||
}
|
||||
|
||||
void ShellProcessTests::testProcessListFromObject()
|
||||
{
|
||||
YAML::Node doc = YAML::Load( R"(---
|
||||
script:
|
||||
- command: "ls /tmp"
|
||||
timeout: 20
|
||||
- "-/bin/false"
|
||||
)" );
|
||||
CommandList cl(
|
||||
CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" ) );
|
||||
QVERIFY( !cl.isEmpty() );
|
||||
QCOMPARE( cl.count(), 2 );
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ private Q_SLOTS:
|
||||
void testProcessListFromList();
|
||||
// Create from a simple YAML string
|
||||
void testProcessListFromString();
|
||||
// Create from a single complex YAML
|
||||
void testProcessFromObject();
|
||||
// Create from a complex YAML list
|
||||
void testProcessListFromObject();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user