summaryrefslogtreecommitdiff
path: root/tools/qa/cppunit/test_urlobj.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-07-26 17:41:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-07-26 17:41:08 +0200
commit44ddacb232c4fd5cbb28867aa28d7d855788a511 (patch)
treeebaf526d737c7044ea18eb73158375a22982e050 /tools/qa/cppunit/test_urlobj.cxx
parent2be3dcd9cc0f66aec026538baa7299663d9986b0 (diff)
fdo#33605: Handle http etc. URLs with no path but fragment
Change-Id: I8c47cc55e7ad53e514c0bd46130cbbe6a1bb0357
Diffstat (limited to 'tools/qa/cppunit/test_urlobj.cxx')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 6719fc8d2030..6b0b3133bd34 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -240,6 +240,27 @@ namespace tools_urlobj
}
}
+ void urlobjTest_emptyPath() {
+ {
+ INetURLObject url(OUString("http://example.com"));
+ CPPUNIT_ASSERT_EQUAL(INET_PROT_HTTP, url.GetProtocol());
+ CPPUNIT_ASSERT_EQUAL(OUString("example.com"), url.GetHost());
+ CPPUNIT_ASSERT_EQUAL(OUString("/"), url.GetURLPath());
+ }
+ {
+ // This is an invalid http URL per RFC 2616:
+ INetURLObject url(OUString("http://example.com?query"));
+ CPPUNIT_ASSERT(url.HasError());
+ }
+ {
+ INetURLObject url(OUString("http://example.com#fragment"));
+ CPPUNIT_ASSERT_EQUAL(INET_PROT_HTTP, url.GetProtocol());
+ CPPUNIT_ASSERT_EQUAL(OUString("example.com"), url.GetHost());
+ CPPUNIT_ASSERT_EQUAL(OUString("/"), url.GetURLPath());
+ CPPUNIT_ASSERT_EQUAL(OUString("fragment"), url.GetMark());
+ }
+ }
+
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
@@ -252,6 +273,7 @@ namespace tools_urlobj
CPPUNIT_TEST( urlobjTest_005 );
CPPUNIT_TEST( urlobjTest_006 );
CPPUNIT_TEST( urlobjCmisTest );
+ CPPUNIT_TEST( urlobjTest_emptyPath );
CPPUNIT_TEST_SUITE_END( );
}; // class createPool