diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-18 20:36:59 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-18 20:38:27 -0800 |
| commit | 6499dd847ca8889ea0aa4a2fe934bcfff9466e60 (patch) | |
| tree | c803365ce80f0174e6c85a6c8ae12a284d73de6a /src/core/url_test.c | |
| parent | 600f81148be4d08b6b1c308165b3eff1c30ac216 (diff) | |
| download | nng-6499dd847ca8889ea0aa4a2fe934bcfff9466e60.tar.gz nng-6499dd847ca8889ea0aa4a2fe934bcfff9466e60.tar.bz2 nng-6499dd847ca8889ea0aa4a2fe934bcfff9466e60.zip | |
Add new nni_url_parse_inline, and add more test cases for coverage.
The inline parsing will be used internally to avoid some allocations.
Diffstat (limited to 'src/core/url_test.c')
| -rw-r--r-- | src/core/url_test.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/url_test.c b/src/core/url_test.c index 4de9d4c2..0e30c29e 100644 --- a/src/core/url_test.c +++ b/src/core/url_test.c @@ -385,6 +385,30 @@ test_url_good_utf8(void) } void +test_url_missing_port(void) +{ + nng_url *url = NULL; + NUTS_FAIL( + nng_url_parse(&url, "http://www.x.com:/something"), NNG_EINVAL); +} + +void +test_url_unknown_service(void) +{ + nng_url *url = NULL; + NUTS_FAIL( + nng_url_parse(&url, "http://www.x.com:nosuchservice"), NNG_EINVAL); +} + +void +test_url_duplicate_userinfo(void) +{ + nng_url *url = NULL; + NUTS_FAIL( + nng_url_parse(&url, "http://user@@user@www.x.com"), NNG_EINVAL); +} + +void test_url_decode(void) { uint8_t out[16]; @@ -463,6 +487,9 @@ NUTS_TESTS = { { "url canonify", test_url_canonify }, { "url path resolve", test_url_path_resolve }, { "url query info pass", test_url_query_info_pass }, + { "url missing port", test_url_missing_port }, + { "url unknown service", test_url_unknown_service }, + { "url duplicate userinfo", test_url_duplicate_userinfo }, { "url bad utf8", test_url_bad_utf8 }, { "url good utf8", test_url_good_utf8 }, { "url decode", test_url_decode }, |
