[partition] Fix up tests

- Although we long ago replaced the getPartitions implementation, the
  test is still there, and on a machine with no /dev/sda (e.g. because
  root is on nvme) the echo-awk-shell-pipeline can give an empty string;
  this is turned into a QStringList{""} which has one element, while
  the new version has 0 elements.
- Special-case the test that empty strings should be empty lists, rather
  than 1-element lists with an empty element.
This commit is contained in:
Adriaan de Groot 2020-04-21 13:35:01 +02:00
parent a0b4b2bf5e
commit f8df49e40f

View File

@ -42,7 +42,11 @@ getPartitionsForDevice_other(const QString& deviceName)
process.start();
process.waitForFinished();
const QString partitions = process.readAllStandardOutput();
const QString partitions = process.readAllStandardOutput().trimmed();
if ( partitions.isEmpty() )
{
return QStringList();
}
const QStringList partitionsList = partitions.simplified().split( ' ' );
return partitionsList;