@@ -50,8 +50,8 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_default)
5050 LT_CHECK_EQ (test_endpoint.is_regex_compiled(), false);
5151LT_END_AUTO_TEST (http_endpoint_default)
5252
53- LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_default )
54- http_endpoint test_endpoint(" /path/to/resource" );
53+ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_registration )
54+ http_endpoint test_endpoint(" /path/to/resource" , false , true , true );
5555
5656 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
5757 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource$");
@@ -66,10 +66,10 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_default)
6666
6767 LT_CHECK_EQ (test_endpoint.is_family_url(), false);
6868 LT_CHECK_EQ (test_endpoint.is_regex_compiled(), true);
69- LT_END_AUTO_TEST (http_endpoint_from_string_default )
69+ LT_END_AUTO_TEST (http_endpoint_from_string_registration )
7070
7171LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_not_beginning_with_slash)
72- http_endpoint test_endpoint(" path/to/resource" );
72+ http_endpoint test_endpoint(" path/to/resource" , false , true , true );
7373
7474 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
7575 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource$");
@@ -87,7 +87,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_not_beginning_
8787LT_END_AUTO_TEST (http_endpoint_from_string_not_beginning_with_slash)
8888
8989LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_ending_with_slash)
90- http_endpoint test_endpoint(" path/to/resource/" );
90+ http_endpoint test_endpoint(" path/to/resource/" , false , true , true );
9191
9292 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
9393 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource$");
@@ -105,7 +105,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_ending_with_sl
105105LT_END_AUTO_TEST (http_endpoint_from_string_ending_with_slash)
106106
107107LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_family)
108- http_endpoint test_endpoint(" /path/to/resource" , true );
108+ http_endpoint test_endpoint(" /path/to/resource" , true , true , true );
109109
110110 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
111111 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource$");
@@ -122,6 +122,24 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_family)
122122 LT_CHECK_EQ (test_endpoint.is_regex_compiled(), true);
123123LT_END_AUTO_TEST (http_endpoint_from_string_family)
124124
125+ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_default_no_regex)
126+ http_endpoint test_endpoint(" /path/to/resource" );
127+
128+ LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
129+ LT_CHECK_EQ (test_endpoint.get_url_normalized(), "/path/to/resource");
130+
131+ LT_CHECK_EQ (test_endpoint.get_url_pars().size(), 0);
132+
133+ string expected_arr[] = { " path" , " to" , " resource" };
134+ vector<string> expected_pieces (expected_arr, expected_arr + sizeof (expected_arr) / sizeof(expected_arr[0 ]));
135+ LT_CHECK_COLLECTIONS_EQ (test_endpoint.get_url_pieces().begin(), test_endpoint.get_url_pieces().end(), expected_pieces.begin());
136+
137+ LT_CHECK_EQ (test_endpoint.get_chunk_positions().size(), 0);
138+
139+ LT_CHECK_EQ (test_endpoint.is_family_url(), false);
140+ LT_CHECK_EQ (test_endpoint.is_regex_compiled(), false);
141+ LT_END_AUTO_TEST (http_endpoint_default_no_regex)
142+
125143LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_no_regex)
126144 http_endpoint test_endpoint(" /path/to/resource" , false , false , false );
127145
@@ -141,7 +159,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_from_string_no_regex)
141159LT_END_AUTO_TEST (http_endpoint_from_string_no_regex)
142160
143161LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration)
144- http_endpoint test_endpoint(" /path/to/resource" , false , true );
162+ http_endpoint test_endpoint(" /path/to/resource" , false , true , true );
145163
146164 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource");
147165 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource$");
@@ -159,7 +177,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration)
159177LT_END_AUTO_TEST (http_endpoint_registration)
160178
161179LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration_nested_regex)
162- http_endpoint test_endpoint(" /path/to/resource/with/[0-9]+/to/fetch" , false , true );
180+ http_endpoint test_endpoint(" /path/to/resource/with/[0-9]+/to/fetch" , false , true , true );
163181
164182 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource/with/[0-9]+/to/fetch");
165183 LT_CHECK_EQ (test_endpoint.get_url_normalized(), "^/path/to/resource/with/[0-9]+/to/fetch$");
@@ -177,7 +195,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration_nested_regex)
177195LT_END_AUTO_TEST (http_endpoint_registration_nested_regex)
178196
179197LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration_arg)
180- http_endpoint test_endpoint(" /path/to/resource/with/{arg}/to/fetch" , false , true );
198+ http_endpoint test_endpoint(" /path/to/resource/with/{arg}/to/fetch" , false , true , true );
181199
182200 LT_CHECK_EQ (test_endpoint.get_url_complete(), "/path/to/resource/with/{arg}/to/fetch" );
183201 LT_CHECK_EQ(test_endpoint.get_url_normalized(), " ^/path/to/resource/with/([^\\/]+)/to/fetch$" );
@@ -199,7 +217,7 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration_arg)
199217LT_END_AUTO_TEST(http_endpoint_registration_arg)
200218
201219LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_registration_arg_custom_regex)
202- http_endpoint test_endpoint(" /path/to/resource/with/{arg|([0 -9 ]+)}/to/fetch" , false, true);
220+ http_endpoint test_endpoint(" /path/to/resource/with/{arg|([0 -9 ]+)}/to/fetch" , false, true, true );
203221
204222 LT_CHECK_EQ(test_endpoint.get_url_complete(), " /path/to/resource/with/{arg|([0 -9 ]+)}/to/fetch" );
205223 LT_CHECK_EQ(test_endpoint.get_url_normalized(), " ^/path/to/resource/with/([0 -9 ]+)/to/fetch$" );
@@ -318,6 +336,10 @@ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_match_regex_disabled)
318336 LT_CHECK_THROW(test_endpoint.match(http_endpoint(" /path/to/resource" )));
319337LT_END_AUTO_TEST(http_endpoint_match_regex_disabled)
320338
339+ LT_BEGIN_AUTO_TEST(http_endpoint_suite, http_endpoint_cannot_use_regex_if_not_registering)
340+ LT_CHECK_THROW(http_endpoint(" /path/to/resource" , false, false, true));
341+ LT_END_AUTO_TEST(http_endpoint_cannot_use_regex_if_not_registering)
342+
321343LT_BEGIN_AUTO_TEST(http_endpoint_suite, comparator)
322344 LT_CHECK_EQ(http_endpoint(" /a/b" ) < http_endpoint(" /a/c" ), true);
323345 LT_CHECK_EQ(http_endpoint(" /a/c" ) < http_endpoint(" /a/b" ), false);
0 commit comments