1
1
/* **
2
2
* ==++==
3
3
*
4
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
7
7
* You may obtain a copy of the License at
8
8
* http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
* ==--==
17
17
* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
18
18
*
19
- * uri_builder_tests.cpp
20
- *
21
19
* Tests for the URI builder class.
22
20
*
23
21
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -49,16 +47,6 @@ static void VERIFY_URI_BUILDER(
49
47
VERIFY_ARE_EQUAL (query, builder.query ());
50
48
VERIFY_ARE_EQUAL (fragment, builder.fragment ());
51
49
}
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
- }
62
50
static void VERIFY_URI_BUILDER (
63
51
uri_builder &builder,
64
52
const utility::string_t &scheme,
@@ -80,27 +68,28 @@ TEST(constructor_tests)
80
68
// Default constructor
81
69
uri_builder builder;
82
70
VERIFY_URI_BUILDER_IS_EMPTY (builder);
83
- // scheme, host, port
71
+ // scheme, user_info, host, port
84
72
utility::string_t scheme (U (" ftp" ));
73
+ utility::string_t user_info (U (" steve:pass" ));
85
74
utility::string_t host (U (" localhost" ));
86
75
int port = 44 ;
87
76
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" ));
89
78
90
79
// 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" ));
92
81
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" )));
94
83
95
84
// copy constructor
96
85
uri_builder other (builder);
97
86
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 ( " " ) );
100
89
101
90
// move constructor
102
91
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 ( " " ) );
104
93
}
105
94
106
95
TEST (assignment_operators)
@@ -248,7 +237,7 @@ TEST(validation)
248
237
249
238
TEST (uri_creation_string)
250
239
{
251
- utility::string_t uri_str (U (" http://localhost:4556/" ));
240
+ utility::string_t uri_str (U (" http://steve:temp@ localhost:4556/" ));
252
241
253
242
// to_string
254
243
uri_builder builder (uri_str);
@@ -263,7 +252,7 @@ TEST(uri_creation_string)
263
252
// to encoded string
264
253
uri_builder with_space (builder);
265
254
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 ());
267
256
}
268
257
269
258
TEST (append_path_string)
0 commit comments