[partition] Coding style on tests

This commit is contained in:
Adriaan de Groot 2020-04-17 00:28:14 +02:00
parent b33e54abb9
commit c7857b7749

View File

@ -26,19 +26,17 @@ QTEST_GUILESS_MAIN( ClearMountsJobTests )
/* Not exactly public API */ /* Not exactly public API */
QStringList QStringList getPartitionsForDevice( const QString& deviceName );
getPartitionsForDevice( const QString& deviceName );
QStringList QStringList
getPartitionsForDevice_other(const QString& deviceName) getPartitionsForDevice_other( const QString& deviceName )
{ {
QProcess process; QProcess process;
process.setProgram( "sh" ); process.setProgram( "sh" );
process.setArguments( { process.setArguments(
"-c", { "-c",
QString( "echo $(awk '{print $4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" ) QString( "echo $(awk '{print $4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" )
.arg( deviceName ) .arg( deviceName ) } );
} );
process.start(); process.start();
process.waitForFinished(); process.waitForFinished();
@ -55,10 +53,11 @@ getPartitionsForDevice_other(const QString& deviceName)
ClearMountsJobTests::ClearMountsJobTests() ClearMountsJobTests::ClearMountsJobTests()
{ {
Logger::setupLogLevel(6); Logger::setupLogLevel( Logger::LOGDEBUG );
} }
void ClearMountsJobTests::testFindPartitions() void
ClearMountsJobTests::testFindPartitions()
{ {
QStringList partitions = getPartitionsForDevice( "sda" ); QStringList partitions = getPartitionsForDevice( "sda" );
QStringList other_part = getPartitionsForDevice_other( "sda" ); QStringList other_part = getPartitionsForDevice_other( "sda" );