Updated Branches: refs/heads/trunk 8db1d9ae2 -> 7eb20c835
more tests Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/7eb20c83 Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/7eb20c83 Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/7eb20c83 Branch: refs/heads/trunk Commit: 7eb20c835705b97820a6327605d0dbf8c57d655f Parents: 8db1d9a Author: Timothy Bish <[email protected]> Authored: Mon Nov 4 20:38:17 2013 -0500 Committer: Timothy Bish <[email protected]> Committed: Mon Nov 4 20:38:17 2013 -0500 ---------------------------------------------------------------------- activemq-cpp/src/test/decaf/net/URLTest.cpp | 31 ++++++++++++++++++++++++ activemq-cpp/src/test/decaf/net/URLTest.h | 5 ++++ 2 files changed, 36 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/7eb20c83/activemq-cpp/src/test/decaf/net/URLTest.cpp ---------------------------------------------------------------------- diff --git a/activemq-cpp/src/test/decaf/net/URLTest.cpp b/activemq-cpp/src/test/decaf/net/URLTest.cpp index e95f23e..7928ba5 100644 --- a/activemq-cpp/src/test/decaf/net/URLTest.cpp +++ b/activemq-cpp/src/test/decaf/net/URLTest.cpp @@ -585,3 +585,34 @@ void URLTest::testFileEqualsWithEmptyHost() { URL b("file:/a/"); CPPUNIT_ASSERT(a.equals(b)); } + +//////////////////////////////////////////////////////////////////////////////// +void URLTest::testOmittedHost() { + URL url("http:///path"); + CPPUNIT_ASSERT_EQUAL(String(""), url.getHost()); + CPPUNIT_ASSERT_EQUAL(String("/path"), url.getFile()); + CPPUNIT_ASSERT_EQUAL(String("/path"), url.getPath()); +} + +//////////////////////////////////////////////////////////////////////////////// +void URLTest::testNoHost() { + URL url("http:/path"); + CPPUNIT_ASSERT_EQUAL(String("http"), url.getProtocol()); + CPPUNIT_ASSERT_EQUAL(String(), url.getAuthority()); + CPPUNIT_ASSERT_EQUAL(String(), url.getUserInfo()); + CPPUNIT_ASSERT_EQUAL(String(), url.getHost()); + CPPUNIT_ASSERT_EQUAL(-1, url.getPort()); + CPPUNIT_ASSERT_EQUAL(80, url.getDefaultPort()); + CPPUNIT_ASSERT_EQUAL(String("/path"), url.getFile()); + CPPUNIT_ASSERT_EQUAL(String("/path"), url.getPath()); + CPPUNIT_ASSERT_EQUAL(String(), url.getQuery()); + CPPUNIT_ASSERT_EQUAL(String(), url.getRef()); +} + +//////////////////////////////////////////////////////////////////////////////// +void URLTest::testNoPath() { + URL url("http://host"); + CPPUNIT_ASSERT_EQUAL(String("host"), url.getHost()); + CPPUNIT_ASSERT_EQUAL(String(), url.getFile()); + CPPUNIT_ASSERT_EQUAL(String(), url.getPath()); +} http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/7eb20c83/activemq-cpp/src/test/decaf/net/URLTest.h ---------------------------------------------------------------------- diff --git a/activemq-cpp/src/test/decaf/net/URLTest.h b/activemq-cpp/src/test/decaf/net/URLTest.h index 0d74156..fd5dce3 100644 --- a/activemq-cpp/src/test/decaf/net/URLTest.h +++ b/activemq-cpp/src/test/decaf/net/URLTest.h @@ -46,6 +46,8 @@ namespace net { CPPUNIT_TEST( testURLStreamHandlerParseURL ); CPPUNIT_TEST( testUrlParts ); CPPUNIT_TEST( testFileEqualsWithEmptyHost ); + CPPUNIT_TEST( testNoHost ); + CPPUNIT_TEST( testNoPath ); CPPUNIT_TEST_SUITE_END(); public: @@ -72,6 +74,9 @@ namespace net { void testURLStreamHandlerParseURL(); void testUrlParts(); void testFileEqualsWithEmptyHost(); + void testOmittedHost(); + void testNoHost(); + void testNoPath(); };
