mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
[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
2 changed files with 31 additions and 0 deletions
|
@ -113,3 +113,30 @@ script: false
|
||||||
QCOMPARE( cl1.count(), 0 );
|
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();
|
void testProcessListFromList();
|
||||||
// Create from a simple YAML string
|
// Create from a simple YAML string
|
||||||
void testProcessListFromString();
|
void testProcessListFromString();
|
||||||
|
// Create from a single complex YAML
|
||||||
|
void testProcessFromObject();
|
||||||
|
// Create from a complex YAML list
|
||||||
|
void testProcessListFromObject();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue