|
@@ -71,6 +71,7 @@ class UtilTest:public CppUnit::TestFixture {
|
|
CPPUNIT_TEST(testGetCidrPrefix);
|
|
CPPUNIT_TEST(testGetCidrPrefix);
|
|
CPPUNIT_TEST(testInSameCidrBlock);
|
|
CPPUNIT_TEST(testInSameCidrBlock);
|
|
CPPUNIT_TEST(testIsUtf8String);
|
|
CPPUNIT_TEST(testIsUtf8String);
|
|
|
|
+ CPPUNIT_TEST(testJoinUri);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
private:
|
|
|
|
|
|
@@ -130,6 +131,7 @@ public:
|
|
void testGetCidrPrefix();
|
|
void testGetCidrPrefix();
|
|
void testInSameCidrBlock();
|
|
void testInSameCidrBlock();
|
|
void testIsUtf8String();
|
|
void testIsUtf8String();
|
|
|
|
+ void testJoinUri();
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -1247,4 +1249,25 @@ void UtilTest::testIsUtf8String()
|
|
CPPUNIT_ASSERT(!util::isUtf8(util::fromHex("00")));
|
|
CPPUNIT_ASSERT(!util::isUtf8(util::fromHex("00")));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void UtilTest::testJoinUri()
|
|
|
|
+{
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://host/dir/file"),
|
|
|
|
+ util::joinUri("http://base/d/f",
|
|
|
|
+ "http://host/dir/file"));
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://base/dir/file"),
|
|
|
|
+ util::joinUri("http://base/d/f",
|
|
|
|
+ "/dir/file"));
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://base/d/dir/file"),
|
|
|
|
+ util::joinUri("http://base/d/f",
|
|
|
|
+ "dir/file"));
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://base/d/"),
|
|
|
|
+ util::joinUri("http://base/d/f",
|
|
|
|
+ ""));
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://base/d/dir/file?q=k"),
|
|
|
|
+ util::joinUri("http://base/d/f",
|
|
|
|
+ "dir/file?q=k"));
|
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("dir/file"),
|
|
|
|
+ util::joinUri("baduri", "dir/file"));
|
|
|
|
+}
|
|
|
|
+
|
|
} // namespace aria2
|
|
} // namespace aria2
|