diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-03-15 07:56:37 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-03-15 07:56:37 +0100 |
commit | 2269fd42e2d44096d368718c314213ff7aafc164 (patch) | |
tree | cbeebb540a37e0e81dc1c85cdac56792291e8623 /tests/lutf8lib.js | |
parent | dd44bc89e607f7e395233e03758ac8e83a8ccc7a (diff) | |
download | fengari-2269fd42e2d44096d368718c314213ff7aafc164.tar.gz fengari-2269fd42e2d44096d368718c314213ff7aafc164.tar.bz2 fengari-2269fd42e2d44096d368718c314213ff7aafc164.zip |
utf8.codepoint
Diffstat (limited to 'tests/lutf8lib.js')
-rw-r--r-- | tests/lutf8lib.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/lutf8lib.js b/tests/lutf8lib.js index 3006bd4..edfae56 100644 --- a/tests/lutf8lib.js +++ b/tests/lutf8lib.js @@ -36,4 +36,48 @@ test('utf8.offset', function (t) { "Correct element(s) on the stack" ); +}); + + +test('utf8.codepoint', function (t) { + let luaCode = ` + return utf8.codepoint("( ͡° ͜ʖ ͡° )", 5, 8) + `, L; + + t.plan(5); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lauxlib.luaL_loadstring(L, luaCode); + + }, "Lua program loaded without error"); + + t.doesNotThrow(function () { + + lapi.lua_call(L, 0, -1); + + }, "Lua program ran without error"); + + t.strictEqual( + lapi.lua_tointeger(L, -3), + 176, + "Correct element(s) on the stack" + ); + + t.strictEqual( + lapi.lua_tointeger(L, -2), + 32, + "Correct element(s) on the stack" + ); + + t.strictEqual( + lapi.lua_tointeger(L, -1), + 860, + "Correct element(s) on the stack" + ); + });
\ No newline at end of file |