[libcalamares] Make other tests more resilient

Use the full path to the test file, rather than assuming the test
is run from the build-directory. Repair check that looked at
the number of keys in the test-file, now that a new key has been added.
This commit is contained in:
Adriaan de Groot 2024-11-05 14:51:11 +01:00
parent 8a095504c4
commit 05bc0cbb09

View File

@ -127,17 +127,14 @@ TestLibCalamares::testGSLoadSave2()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
const QString filename( "../src/libcalamares/testdata/yaml-list.conf" );
if ( !QFile::exists( filename ) )
{
return;
}
const QString filename( BUILD_AS_TEST "/testdata/yaml-list.conf" );
QVERIFY2( QFile::exists( filename ), qPrintable( filename ) );
Calamares::GlobalStorage gs1;
const QString key( "dwarfs" );
QVERIFY( gs1.loadYaml( filename ) );
QCOMPARE( gs1.count(), 3 ); // From examining the file
QCOMPARE( gs1.count(), 4 ); // From examining the file
QVERIFY( gs1.contains( key ) );
cDebug() << Calamares::typeOf( gs1.value( key ) ) << gs1.value( key );
QCOMPARE( Calamares::typeOf( gs1.value( key ) ), Calamares::ListVariantType );