11/* **
22* ==++==
33*
4- * Copyright (c) Microsoft Corporation. All rights reserved.
4+ * Copyright (c) Microsoft Corporation. All rights reserved.
55* Licensed under the Apache License, Version 2.0 (the "License");
66* you may not use this file except in compliance with the License.
77* You may obtain a copy of the License at
88* http://www.apache.org/licenses/LICENSE-2.0
9- *
9+ *
1010* Unless required by applicable law or agreed to in writing, software
1111* distributed under the License is distributed on an "AS IS" BASIS,
1212* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616* ==--==
1717* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
1818*
19- * uri_builder_tests.cpp
20- *
2119* Tests for the URI builder class.
2220*
2321* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -49,16 +47,6 @@ static void VERIFY_URI_BUILDER(
4947 VERIFY_ARE_EQUAL (query, builder.query ());
5048 VERIFY_ARE_EQUAL (fragment, builder.fragment ());
5149}
52-
53- static void VERIFY_URI_BUILDER (
54- uri_builder &builder,
55- const utility::string_t &scheme,
56- const utility::string_t &host,
57- const int port,
58- const utility::string_t &path)
59- {
60- VERIFY_URI_BUILDER (builder, scheme, utility::string_t (), host, port, path, utility::string_t (), utility::string_t ());
61- }
6250static void VERIFY_URI_BUILDER (
6351 uri_builder &builder,
6452 const utility::string_t &scheme,
@@ -80,27 +68,28 @@ TEST(constructor_tests)
8068 // Default constructor
8169 uri_builder builder;
8270 VERIFY_URI_BUILDER_IS_EMPTY (builder);
83- // scheme, host, port
71+ // scheme, user_info, host, port
8472 utility::string_t scheme (U (" ftp" ));
73+ utility::string_t user_info (U (" steve:pass" ));
8574 utility::string_t host (U (" localhost" ));
8675 int port = 44 ;
8776 utility::string_t path (U (" /Yeshere888" ));
88- utility::string_t uri_str (U (" ftp://localhost:44/Yeshere888" ));
77+ utility::string_t uri_str (U (" ftp://steve:pass@ localhost:44/Yeshere888" ));
8978
9079 // utility::string_t
91- utility::string_t uri_wstr (U (" ftp://localhost:44/Yeshere888?abc:123&abc2:456#nose" ));
80+ utility::string_t uri_wstr (U (" ftp://steve:pass@ localhost:44/Yeshere888?abc:123&abc2:456#nose" ));
9281 builder = uri_builder (uri_wstr);
93- VERIFY_URI_BUILDER (builder, scheme, utility::string_t () , host, port, path, utility::string_t (U (" abc:123&abc2:456" )), utility::string_t (U (" nose" )));
82+ VERIFY_URI_BUILDER (builder, scheme, user_info , host, port, path, utility::string_t (U (" abc:123&abc2:456" )), utility::string_t (U (" nose" )));
9483
9584 // copy constructor
9685 uri_builder other (builder);
9786 builder = uri_builder (uri_str);
98- VERIFY_URI_BUILDER (other, scheme, utility::string_t () , host, port, path, utility::string_t (U (" abc:123&abc2:456" )), utility::string_t (U (" nose" )));
99- VERIFY_URI_BUILDER (builder, scheme, host, port, path);
87+ VERIFY_URI_BUILDER (other, scheme, user_info , host, port, path, utility::string_t (U (" abc:123&abc2:456" )), utility::string_t (U (" nose" )));
88+ VERIFY_URI_BUILDER (builder, scheme, user_info, host, port, path, U ( " " ), U ( " " ) );
10089
10190 // move constructor
10291 uri_builder move_other = std::move (builder);
103- VERIFY_URI_BUILDER (move_other, scheme, host, port, path);
92+ VERIFY_URI_BUILDER (move_other, scheme, user_info, host, port, path, U ( " " ), U ( " " ) );
10493}
10594
10695TEST (assignment_operators)
@@ -248,7 +237,7 @@ TEST(validation)
248237
249238TEST (uri_creation_string)
250239{
251- utility::string_t uri_str (U (" http://localhost:4556/" ));
240+ utility::string_t uri_str (U (" http://steve:temp@ localhost:4556/" ));
252241
253242 // to_string
254243 uri_builder builder (uri_str);
@@ -263,7 +252,7 @@ TEST(uri_creation_string)
263252 // to encoded string
264253 uri_builder with_space (builder);
265254 with_space.set_path (utility::string_t (U (" path%20with%20space" )));
266- VERIFY_ARE_EQUAL (U (" http://localhost:4556/path%20with%20space" ), with_space.to_string ());
255+ VERIFY_ARE_EQUAL (U (" http://steve:temp@ localhost:4556/path%20with%20space" ), with_space.to_string ());
267256}
268257
269258TEST (append_path_string)
0 commit comments