[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:
Adriaan de Groot 2018-01-29 17:38:16 +01:00
parent fe2be46d3f
commit 4917b5c778
2 changed files with 31 additions and 0 deletions

View File

@ -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 );
}

View File

@ -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