summaryrefslogtreecommitdiff
path: root/test/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-09 23:30:51 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-09 23:30:51 +0100
commitc379a9e5f031dfafa0dc0e132061610b706a7b28 (patch)
treef4b64cbd689afec56ee901319ffad29b49d27f26 /test/core
parent9a131feeb507988b9bde7ff1baccf4e13fe903c4 (diff)
got a trivial version of the ResourceLocator to work.
Diffstat (limited to 'test/core')
-rw-r--r--test/core/ResourceLocatorTest.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/core/ResourceLocatorTest.cpp b/test/core/ResourceLocatorTest.cpp
index 08259b6..a3860c5 100644
--- a/test/core/ResourceLocatorTest.cpp
+++ b/test/core/ResourceLocatorTest.cpp
@@ -24,28 +24,33 @@
namespace ousia {
-//TODO: This does not work yet!
-
class TestResourceLocator : public ResourceLocator {
- ResourceLocation locate(const std::string &path,
- const std::string &relativeTo,
- const ResourceType type) const override
+public:
+ ResourceLocator::Location locate(
+ const std::string &path, const std::string &relativeTo,
+ const ResourceLocator::Type type) const override
{
// trivial test implementation.
- return ResourceLocation(true, *this, type, path);
+ return ResourceLocator::Location(true, *this, type, path);
}
- std::istream stream(const std::string &location) const override {
- //trivial test implementation.
- std::stringstream ss;
- ss << "test";
+ std::unique_ptr<std::istream> stream(
+ const std::string &location) const override
+ {
+ // trivial test implementation.
+ std::unique_ptr<std::stringstream> ss(new std::stringstream());
+ (*ss) << "test";
return std::move(ss);
}
-
};
TEST(ResourceLocator, locate)
{
-
+ TestResourceLocator instance;
+ ResourceLocator::Location location =
+ instance.locate("path", "", ResourceLocator::Type::DOMAIN);
+ ASSERT_TRUE(location.found);
+ ASSERT_EQ(ResourceLocator::Type::DOMAIN, location.type);
+ ASSERT_EQ("path", location.location);
}
}