aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:15:22 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:15:22 +0100
commit9d78ee372d9d4db601098d4d302df48159d7b176 (patch)
treea00fa6e59c74d4e4ded1c00adbbf510d156aa768 /tests
parentc3c1ab50646165c0e43784acb30a353dc5b40d12 (diff)
downloadfengari-9d78ee372d9d4db601098d4d302df48159d7b176.tar.gz
fengari-9d78ee372d9d4db601098d4d302df48159d7b176.tar.bz2
fengari-9d78ee372d9d4db601098d4d302df48159d7b176.zip
string.rep
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 7120525..56fa2a3 100644
--- a/tests/lstrlib.js
+++ b/tests/lstrlib.js
@@ -115,4 +115,35 @@ test('string.upper, string.lower', function (t) {
"hello",
"Correct element(s) on the stack"
);
+});
+
+
+test('string.rep', function (t) {
+ let luaCode = `
+ return string.rep("hello", 3, ", ")
+ `, 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, hello, hello",
+ "Correct element(s) on the stack"
+ );
}); \ No newline at end of file