From f8df49e40f198c073f453735d5e42e7d102005ab Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 13:35:01 +0200 Subject: [PATCH] [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. --- src/modules/partition/tests/ClearMountsJobTests.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/tests/ClearMountsJobTests.cpp b/src/modules/partition/tests/ClearMountsJobTests.cpp index 1f01c4638..17ff48945 100644 --- a/src/modules/partition/tests/ClearMountsJobTests.cpp +++ b/src/modules/partition/tests/ClearMountsJobTests.cpp @@ -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;