mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
[libcalamares] Implement object-style command line
- handle command: and timeout: entries - test for setting the values
This commit is contained in:
parent
72bac332be
commit
c641f5dec6
3 changed files with 46 additions and 1 deletions
|
@ -102,6 +102,8 @@ script: "ls /tmp"
|
|||
CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" ) );
|
||||
QVERIFY( !cl.isEmpty() );
|
||||
QCOMPARE( cl.count(), 1 );
|
||||
QCOMPARE( cl.at(0).timeout(), 10 );
|
||||
QCOMPARE( cl.at(0).command(), QStringLiteral( "ls /tmp" ) );
|
||||
|
||||
// Not a string
|
||||
doc = YAML::Load( R"(---
|
||||
|
@ -125,6 +127,8 @@ script:
|
|||
CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" ) );
|
||||
QVERIFY( !cl.isEmpty() );
|
||||
QCOMPARE( cl.count(), 1 );
|
||||
QCOMPARE( cl.at(0).timeout(), 20 );
|
||||
QCOMPARE( cl.at(0).command(), QStringLiteral( "ls /tmp" ) );
|
||||
}
|
||||
|
||||
void ShellProcessTests::testProcessListFromObject()
|
||||
|
@ -132,11 +136,14 @@ void ShellProcessTests::testProcessListFromObject()
|
|||
YAML::Node doc = YAML::Load( R"(---
|
||||
script:
|
||||
- command: "ls /tmp"
|
||||
timeout: 20
|
||||
timeout: 12
|
||||
- "-/bin/false"
|
||||
)" );
|
||||
CommandList cl(
|
||||
CalamaresUtils::yamlMapToVariant( doc ).toMap().value( "script" ) );
|
||||
QVERIFY( !cl.isEmpty() );
|
||||
QCOMPARE( cl.count(), 2 );
|
||||
QCOMPARE( cl.at(0).timeout(), 12 );
|
||||
QCOMPARE( cl.at(0).command(), QStringLiteral( "ls /tmp" ) );
|
||||
QCOMPARE( cl.at(1).timeout(), 10 ); // default
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue