6
6
7
7
#include "test-libmongoc.h"
8
8
9
+ #define ASSERT_SUPPRESS (x ) \
10
+ do { \
11
+ suppress_one_message (); \
12
+ ASSERT (x); \
13
+ } while (0)
14
+
9
15
static void
10
16
test_mongoc_uri_new (void )
11
17
{
@@ -19,6 +25,22 @@ test_mongoc_uri_new (void)
19
25
20
26
/* bad uris */
21
27
ASSERT (!mongoc_uri_new ("mongodb://" ));
28
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://\x80" ));
29
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://localhost/\x80" ));
30
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://localhost:\x80/" ));
31
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://localhost/?ipv6=\x80" ));
32
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://localhost/?foo=\x80" ));
33
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://localhost/?\x80=bar" ));
34
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://\x80:pass@localhost" ));
35
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://user:\x80@localhost" ));
36
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://user%40DOMAIN.COM:password@localhost/?"
37
+ "authMechanism=\x80" ));
38
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://user%40DOMAIN.COM:password@localhost/?"
39
+ "authMechanism=GSSAPI"
40
+ "&authMechanismProperties=SERVICE_NAME:\x80" ));
41
+ ASSERT_SUPPRESS (!mongoc_uri_new ("mongodb://user%40DOMAIN.COM:password@localhost/?"
42
+ "authMechanism=GSSAPI"
43
+ "&authMechanismProperties=\x80:mongodb" ));
22
44
ASSERT (!mongoc_uri_new ("mongodb://::" ));
23
45
ASSERT (!mongoc_uri_new ("mongodb://localhost::27017" ));
24
46
ASSERT (!mongoc_uri_new ("mongodb://localhost,localhost::" ));
@@ -347,6 +369,8 @@ test_mongoc_uri_new (void)
347
369
mongoc_uri_destroy (uri );
348
370
}
349
371
372
+ #undef ASSERT_SUPPRESS
373
+
350
374
static void
351
375
test_mongoc_host_list_from_string (void )
352
376
{
0 commit comments