Fix semantics of isEmpty()

This commit is contained in:
TheAssassin
2018-11-09 00:58:09 +01:00
parent 78e5d0858e
commit 169275e023
3 changed files with 7 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ public:
public:
bool isEmpty() {
return path.empty();
return sections.empty();
}
void assertPathIsNotEmptyAndFileExists() {

View File

@@ -39,7 +39,7 @@ public:
bool operator!=(const DesktopFileReader& other) const;
public:
// checks whether a file has been read already
// checks whether parsed data is available
bool isEmpty() const;
// returns desktop file path

View File

@@ -21,7 +21,7 @@ TEST_F(DesktopFileReaderFixture, testPathConstructor) {
bf::path path = "/dev/null";
DesktopFileReader reader(path);
EXPECT_FALSE(reader.isEmpty());
EXPECT_TRUE(reader.isEmpty());
ASSERT_THROW(DesktopFileReader("/no/such/file/or/directory"), std::invalid_argument);
}
@@ -51,10 +51,10 @@ TEST_F(DesktopFileReaderFixture, testCopyConstructor) {
bf::path path = "/dev/null";
DesktopFileReader reader(path);
EXPECT_FALSE(reader.isEmpty());
EXPECT_TRUE(reader.isEmpty());
DesktopFileReader copy = reader;
EXPECT_FALSE(copy.isEmpty());
EXPECT_TRUE(copy.isEmpty());
EXPECT_EQ(reader, copy);
}
@@ -66,7 +66,7 @@ TEST_F(DesktopFileReaderFixture, testCopyAssignmentConstructor) {
EXPECT_TRUE(reader.isEmpty());
DesktopFileReader otherReader(path);
EXPECT_FALSE(otherReader.isEmpty());
EXPECT_TRUE(otherReader.isEmpty());
reader = otherReader;
EXPECT_EQ(reader.path(), path);
@@ -82,7 +82,7 @@ TEST_F(DesktopFileReaderFixture, testMoveAssignmentConstructor) {
EXPECT_TRUE(reader.isEmpty());
DesktopFileReader otherReader(path);
EXPECT_FALSE(otherReader.isEmpty());
EXPECT_TRUE(otherReader.isEmpty());
reader = std::move(otherReader);
EXPECT_EQ(reader.path(), path);