diff options
Diffstat (limited to 'test/plugins')
-rw-r--r-- | test/plugins/css/CSSParserTest.cpp | 7 | ||||
-rw-r--r-- | test/plugins/filesystem/FileLocatorTest.cpp | 20 | ||||
-rw-r--r-- | test/plugins/xml/XmlParserTest.cpp | 8 |
3 files changed, 22 insertions, 13 deletions
diff --git a/test/plugins/css/CSSParserTest.cpp b/test/plugins/css/CSSParserTest.cpp index 84522b3..420241e 100644 --- a/test/plugins/css/CSSParserTest.cpp +++ b/test/plugins/css/CSSParserTest.cpp @@ -26,8 +26,6 @@ #include <core/parser/StandaloneParserContext.hpp> namespace ousia { -namespace parser { -namespace css { TEST(CSSParser, testParseSelectors) { // create a string describing a SelectorTree @@ -268,8 +266,7 @@ void assertException(std::string css) CharReader reader(css); TerminalLogger logger(std::cerr, true); { - ScopedLogger sl(logger, "test.css", SourceLocation{}, - CharReader::contextCallback, &reader); + ScopedLogger sl(logger); StandaloneParserContext ctx(sl); CSSParser instance; @@ -296,5 +293,3 @@ TEST(CSSParser, testParseExceptions) assertException("A > "); } } -} -} diff --git a/test/plugins/filesystem/FileLocatorTest.cpp b/test/plugins/filesystem/FileLocatorTest.cpp index 17d43dd..beb091d 100644 --- a/test/plugins/filesystem/FileLocatorTest.cpp +++ b/test/plugins/filesystem/FileLocatorTest.cpp @@ -142,6 +142,26 @@ TEST(FileLocator, testLocate) assert_not_located(locator, "c.txt", "", ResourceType::SCRIPT); } +TEST(FileLocator, testLocateRelative) +{ + FileLocator locator; + locator.addUnittestSearchPath("filesystem"); + + // Add the respective search path + locator.addUnittestSearchPath("filesystem/b"); + + Resource resA, resC; + ASSERT_TRUE(locator.locate(resA, "a.txt")); + ASSERT_TRUE(locator.locate(resC, "c.txt")); + + Resource resD; + ASSERT_TRUE(locator.locate(resD, "d.txt")); + ASSERT_TRUE(locator.locate(resD, "d.txt", ResourceType::UNKNOWN, resA)); + ASSERT_TRUE(locator.locate(resD, "d.txt", ResourceType::UNKNOWN, resC)); + ASSERT_FALSE(locator.locate(resD, "./d.txt", ResourceType::UNKNOWN, resA)); + ASSERT_TRUE(locator.locate(resD, "./d.txt", ResourceType::UNKNOWN, resC)); +} + TEST(FileLocator, testStream) { FileLocator locator; diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp index f1956e0..52b64e5 100644 --- a/test/plugins/xml/XmlParserTest.cpp +++ b/test/plugins/xml/XmlParserTest.cpp @@ -20,14 +20,13 @@ #include <gtest/gtest.h> +#include <core/common/CharReader.hpp> #include <core/common/Logger.hpp> #include <core/parser/StandaloneParserContext.hpp> #include <plugins/xml/XmlParser.hpp> namespace ousia { -namespace parser { -namespace xml { static TerminalLogger logger(std::cerr, true); @@ -41,7 +40,6 @@ TEST(XmlParser, mismatchedTagException) p.parse("<document>\n</document2>", ctx.context); } catch (LoggableException ex) { - ASSERT_EQ(2, ex.loc.line); hadException = true; } ASSERT_TRUE(hadException); @@ -82,8 +80,6 @@ TEST(XmlParser, namespaces) XmlParser p; CharReader reader(TEST_DATA); { - ScopedLogger sl(logger, "test.oxd", SourceLocation{}, - CharReader::contextCallback, &reader); try { p.parse(TEST_DATA, ctx.context); } @@ -94,6 +90,4 @@ TEST(XmlParser, namespaces) } } } -} -} |