68 lines
2.4 KiB
JSON
68 lines
2.4 KiB
JSON
{
|
|
"description": "Javascript Code",
|
|
"bson_type": "0x0D",
|
|
"test_key": "a",
|
|
"valid": [
|
|
{
|
|
"description": "Empty string",
|
|
"canonical_bson": "0D0000000D6100010000000000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\"}}"
|
|
},
|
|
{
|
|
"description": "Single character",
|
|
"canonical_bson": "0E0000000D610002000000620000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"b\"}}"
|
|
},
|
|
{
|
|
"description": "Multi-character",
|
|
"canonical_bson": "190000000D61000D0000006162616261626162616261620000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"abababababab\"}}"
|
|
},
|
|
{
|
|
"description": "two-byte UTF-8 (\u00e9)",
|
|
"canonical_bson": "190000000D61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\"}}"
|
|
},
|
|
{
|
|
"description": "three-byte UTF-8 (\u2606)",
|
|
"canonical_bson": "190000000D61000D000000E29886E29886E29886E298860000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"\\u2606\\u2606\\u2606\\u2606\"}}"
|
|
},
|
|
{
|
|
"description": "Embedded nulls",
|
|
"canonical_bson": "190000000D61000D0000006162006261620062616261620000",
|
|
"canonical_extjson": "{\"a\" : {\"$code\" : \"ab\\u0000bab\\u0000babab\"}}"
|
|
}
|
|
],
|
|
"decodeErrors": [
|
|
{
|
|
"description": "bad code string length: 0 (but no 0x00 either)",
|
|
"bson": "0C0000000D61000000000000"
|
|
},
|
|
{
|
|
"description": "bad code string length: -1",
|
|
"bson": "0C0000000D6100FFFFFFFF00"
|
|
},
|
|
{
|
|
"description": "bad code string length: eats terminator",
|
|
"bson": "100000000D6100050000006200620000"
|
|
},
|
|
{
|
|
"description": "bad code string length: longer than rest of document",
|
|
"bson": "120000000D00FFFFFF00666F6F6261720000"
|
|
},
|
|
{
|
|
"description": "code string is not null-terminated",
|
|
"bson": "100000000D610004000000616263FF00"
|
|
},
|
|
{
|
|
"description": "empty code string, but extra null",
|
|
"bson": "0E0000000D610001000000000000"
|
|
},
|
|
{
|
|
"description": "invalid UTF-8",
|
|
"bson": "0E0000000D610002000000E90000"
|
|
}
|
|
]
|
|
}
|