summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:19:25 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:19:25 +0100
commitc760da2581a144ca120b07c52963e1d422f725f1 (patch)
treec3594947d848ea536ba84a9148215375d9126d0d /tests
parent9d78ee372d9d4db601098d4d302df48159d7b176 (diff)
downloadfengari-c760da2581a144ca120b07c52963e1d422f725f1.tar.gz
fengari-c760da2581a144ca120b07c52963e1d422f725f1.tar.bz2
fengari-c760da2581a144ca120b07c52963e1d422f725f1.zip
string.reverse
Diffstat (limited to 'tests')
-rw-r--r--tests/lstrlib.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lstrlib.js b/tests/lstrlib.js
index 56fa2a3..d4e8493 100644
--- a/tests/lstrlib.js
+++ b/tests/lstrlib.js
@@ -146,4 +146,35 @@ test('string.rep', function (t) {
"hello, hello, hello",
"Correct element(s) on the stack"
);
+});
+
+
+test('string.reverse', function (t) {
+ let luaCode = `
+ return string.reverse("olleh")
+ `, L;
+
+ t.plan(3);
+
+ 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_tostring(L, -1),
+ "hello",
+ "Correct element(s) on the stack"
+ );
}); \ No newline at end of file