From f4133a97db58f0c3fa5fe973f7aea1d44dc12e53 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 30 Nov 2020 15:38:17 +0100 Subject: [PATCH] [libcalamares] Make test a bit more verbose (before failing) --- src/libcalamares/utils/Tests.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 8aa0e276e..6d4f5b265 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -100,6 +100,8 @@ LibCalamaresTests::testDebugLevels() void LibCalamaresTests::testLoadSaveYaml() { + Logger::setupLogLevel( Logger::LOGDEBUG ); + QFile f( "settings.conf" ); // Find the nearest settings.conf to read for ( unsigned int up = 0; !f.exists() && ( up < 4 ); ++up ) @@ -110,6 +112,19 @@ LibCalamaresTests::testLoadSaveYaml() QVERIFY( f.exists() ); 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 ); auto other_map = CalamaresUtils::loadYaml( "out.yaml" );