[libcalamares] Make test a bit more verbose (before failing)

This commit is contained in:
Adriaan de Groot 2020-11-30 15:38:17 +01:00
parent fa7d2bda16
commit f4133a97db

View File

@ -100,6 +100,8 @@ LibCalamaresTests::testDebugLevels()
void void
LibCalamaresTests::testLoadSaveYaml() LibCalamaresTests::testLoadSaveYaml()
{ {
Logger::setupLogLevel( Logger::LOGDEBUG );
QFile f( "settings.conf" ); QFile f( "settings.conf" );
// Find the nearest settings.conf to read // Find the nearest settings.conf to read
for ( unsigned int up = 0; !f.exists() && ( up < 4 ); ++up ) for ( unsigned int up = 0; !f.exists() && ( up < 4 ); ++up )
@ -110,6 +112,19 @@ LibCalamaresTests::testLoadSaveYaml()
QVERIFY( f.exists() ); QVERIFY( f.exists() );
auto map = CalamaresUtils::loadYaml( f.fileName() ); auto map = CalamaresUtils::loadYaml( f.fileName() );
QVERIFY( map.contains( "sequence" ) );
QCOMPARE( map[ "sequence" ].type(), QVariant::List );
// The source-repo example `settings.conf` has a show and an exec phase
auto sequence = map[ "sequence" ].toList();
cDebug() << "Loaded example `settings.conf` sequence:";
for ( const auto& v : sequence )
{
cDebug() << Logger::SubEntry << v;
QCOMPARE( v.type(), QVariant::Map );
QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) );
}
CalamaresUtils::saveYaml( "out.yaml", map ); CalamaresUtils::saveYaml( "out.yaml", map );
auto other_map = CalamaresUtils::loadYaml( "out.yaml" ); auto other_map = CalamaresUtils::loadYaml( "out.yaml" );