diff options
| author | daurnimator <quae@daurnimator.com> | 2018-01-06 19:32:31 +1100 | 
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2018-01-06 19:32:43 +1100 | 
| commit | a0fa83dc9c170542630dbc83d1732d3e7a6313e9 (patch) | |
| tree | f49965560f11a43e0fcb8dbc6bae1ce9ee22cb93 /tests/defs.js | |
| parent | 110636150e4b3470e21622b022bec2844d8e8b2f (diff) | |
| download | fengari-a0fa83dc9c170542630dbc83d1732d3e7a6313e9.tar.gz fengari-a0fa83dc9c170542630dbc83d1732d3e7a6313e9.tar.bz2 fengari-a0fa83dc9c170542630dbc83d1732d3e7a6313e9.zip | |
Expose lua.luastring_of to construct a lua 'string' from raw byte values
Diffstat (limited to 'tests/defs.js')
| -rw-r--r-- | tests/defs.js | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/tests/defs.js b/tests/defs.js index 1a935d6..f24dee0 100644 --- a/tests/defs.js +++ b/tests/defs.js @@ -6,37 +6,37 @@ const unicode_tests = [      {          description: "Convert normal ascii string",          literal: "foo", -        byte_array: defs.string_of("f".charCodeAt(0), "o".charCodeAt(0), "o".charCodeAt(0)) +        byte_array: defs.luastring_of("f".charCodeAt(0), "o".charCodeAt(0), "o".charCodeAt(0))      },      {          description: "Convert ascii string containing null byte",          literal: "fo\0o", -        byte_array: defs.string_of("f".charCodeAt(0), "o".charCodeAt(0), 0, "o".charCodeAt(0)) +        byte_array: defs.luastring_of("f".charCodeAt(0), "o".charCodeAt(0), 0, "o".charCodeAt(0))      },      {          description: "Convert string with BMP unicode chars",          literal: "Café", -        byte_array: defs.string_of(67, 97, 102, 195, 169) +        byte_array: defs.luastring_of(67, 97, 102, 195, 169)      },      {          description: "Convert string with codepoint in PUA (U+E000 to U+F8FF)",          literal: "", -        byte_array: defs.string_of(239, 163, 191) +        byte_array: defs.luastring_of(239, 163, 191)      },      {          description: "Convert string with surrogate pair",          literal: "❤️🍾", -        byte_array: defs.string_of(226, 157, 164, 239, 184, 143, 240, 159, 141, 190) +        byte_array: defs.luastring_of(226, 157, 164, 239, 184, 143, 240, 159, 141, 190)      },      {          description: "Convert string with broken surrogate pair",          literal: "\uD800a", -        byte_array: defs.string_of(237, 160, 128, 97) +        byte_array: defs.luastring_of(237, 160, 128, 97)      },      {          description: "Convert string with broken surrogate pair at end of string",          literal: "\uD823", -        byte_array: defs.string_of(237, 160, 163) +        byte_array: defs.luastring_of(237, 160, 163)      }  ]; | 
