You've already forked linuxdeploy
mirror of
https://github.com/encounter/linuxdeploy.git
synced 2026-03-30 11:18:58 -07:00
Allow construction from istream
This commit is contained in:
@@ -48,6 +48,10 @@ DesktopFileReader::DesktopFileReader(boost::filesystem::path path) : DesktopFile
|
||||
d->parse(ifs);
|
||||
}
|
||||
|
||||
DesktopFileReader::DesktopFileReader(std::istream& is) : DesktopFileReader() {
|
||||
d->parse(is);
|
||||
}
|
||||
|
||||
DesktopFileReader::DesktopFileReader(const DesktopFileReader& other) : DesktopFileReader() {
|
||||
d->copyData(other.d);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// system includes
|
||||
#include <memory>
|
||||
#include <istream>
|
||||
|
||||
// library includes
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -19,6 +20,9 @@ public:
|
||||
// construct from path
|
||||
explicit DesktopFileReader(boost::filesystem::path path);
|
||||
|
||||
// construct from existing istream
|
||||
explicit DesktopFileReader(std::istream& is);
|
||||
|
||||
// copy constructor
|
||||
DesktopFileReader(const DesktopFileReader& other);
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ TEST_F(DesktopFileReaderFixture, testPathConstructor) {
|
||||
EXPECT_FALSE(reader.isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(DesktopFileReaderFixture, testStreamConstructor) {
|
||||
std::stringstream ss;
|
||||
DesktopFileReader reader(ss);
|
||||
|
||||
EXPECT_TRUE(reader.isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(DesktopFileReaderFixture, testPathConstructorWithEmptyPath) {
|
||||
ASSERT_THROW(DesktopFileReader(""), std::invalid_argument);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user