| 1 |
{ |
| 2 |
"description": "String", |
| 3 |
"bson_type": "0x02", |
| 4 |
"test_key": "a", |
| 5 |
"valid": [ |
| 6 |
{ |
| 7 |
"description": "Empty string", |
| 8 |
"canonical_bson": "0D000000026100010000000000", |
| 9 |
"canonical_extjson": "{\"a\" : \"\"}" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"description": "Single character", |
| 13 |
"canonical_bson": "0E00000002610002000000620000", |
| 14 |
"canonical_extjson": "{\"a\" : \"b\"}" |
| 15 |
}, |
| 16 |
{ |
| 17 |
"description": "Multi-character", |
| 18 |
"canonical_bson": "190000000261000D0000006162616261626162616261620000", |
| 19 |
"canonical_extjson": "{\"a\" : \"abababababab\"}" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"description": "two-byte UTF-8 (\u00e9)", |
| 23 |
"canonical_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000", |
| 24 |
"canonical_extjson": "{\"a\" : \"\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\"}" |
| 25 |
}, |
| 26 |
{ |
| 27 |
"description": "three-byte UTF-8 (\u2606)", |
| 28 |
"canonical_bson": "190000000261000D000000E29886E29886E29886E298860000", |
| 29 |
"canonical_extjson": "{\"a\" : \"\\u2606\\u2606\\u2606\\u2606\"}" |
| 30 |
}, |
| 31 |
{ |
| 32 |
"description": "Embedded nulls", |
| 33 |
"canonical_bson": "190000000261000D0000006162006261620062616261620000", |
| 34 |
"canonical_extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}" |
| 35 |
}, |
| 36 |
{ |
| 37 |
"description": "Required escapes", |
| 38 |
"canonical_bson" : "320000000261002600000061625C220102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F61620000", |
| 39 |
"canonical_extjson" : "{\"a\":\"ab\\\\\\\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001fab\"}" |
| 40 |
} |
| 41 |
], |
| 42 |
"decodeErrors": [ |
| 43 |
{ |
| 44 |
"description": "bad string length: 0 (but no 0x00 either)", |
| 45 |
"bson": "0C0000000261000000000000" |
| 46 |
}, |
| 47 |
{ |
| 48 |
"description": "bad string length: -1", |
| 49 |
"bson": "0C000000026100FFFFFFFF00" |
| 50 |
}, |
| 51 |
{ |
| 52 |
"description": "bad string length: eats terminator", |
| 53 |
"bson": "10000000026100050000006200620000" |
| 54 |
}, |
| 55 |
{ |
| 56 |
"description": "bad string length: longer than rest of document", |
| 57 |
"bson": "120000000200FFFFFF00666F6F6261720000" |
| 58 |
}, |
| 59 |
{ |
| 60 |
"description": "string is not null-terminated", |
| 61 |
"bson": "1000000002610004000000616263FF00" |
| 62 |
}, |
| 63 |
{ |
| 64 |
"description": "empty string, but extra null", |
| 65 |
"bson": "0E00000002610001000000000000" |
| 66 |
}, |
| 67 |
{ |
| 68 |
"description": "invalid UTF-8", |
| 69 |
"bson": "0E00000002610002000000E90000" |
| 70 |
} |
| 71 |
] |
| 72 |
} |