1{ 2 "description": "Javascript Code", 3 "bson_type": "0x0D", 4 "test_key": "a", 5 "valid": [ 6 { 7 "description": "Empty string", 8 "canonical_bson": "0D0000000D6100010000000000", 9 "canonical_extjson": "{\"a\" : {\"$code\" : \"\"}}" 10 }, 11 { 12 "description": "Single character", 13 "canonical_bson": "0E0000000D610002000000620000", 14 "canonical_extjson": "{\"a\" : {\"$code\" : \"b\"}}" 15 }, 16 { 17 "description": "Multi-character", 18 "canonical_bson": "190000000D61000D0000006162616261626162616261620000", 19 "canonical_extjson": "{\"a\" : {\"$code\" : \"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 "decodeErrors": [ 38 { 39 "description": "bad code string length: 0 (but no 0x00 either)", 40 "bson": "0C0000000261000000000000" 41 }, 42 { 43 "description": "bad code string length: -1", 44 "bson": "0C000000026100FFFFFFFF00" 45 }, 46 { 47 "description": "bad code string length: eats terminator", 48 "bson": "10000000026100050000006200620000" 49 }, 50 { 51 "description": "bad code string length: longer than rest of document", 52 "bson": "120000000200FFFFFF00666F6F6261720000" 53 }, 54 { 55 "description": "code string is not null-terminated", 56 "bson": "1000000002610004000000616263FF00" 57 }, 58 { 59 "description": "empty code string, but extra null", 60 "bson": "0E00000002610001000000000000" 61 }, 62 { 63 "description": "invalid UTF-8", 64 "bson": "0E00000002610002000000E90000" 65 } 66 ] 67} 68