diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-09 17:02:31 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-09 17:10:18 +1000 |
commit | 3e439ed653093e6e124a4997f64053164f1043b8 (patch) | |
tree | 3ed7655d34183464523c4cbd8472970f1df37605 /tests | |
parent | 3f2f887666b49b81f9e9b5dbebaeca0fc3543a3c (diff) | |
download | fengari-3e439ed653093e6e124a4997f64053164f1043b8.tar.gz fengari-3e439ed653093e6e124a4997f64053164f1043b8.tar.bz2 fengari-3e439ed653093e6e124a4997f64053164f1043b8.zip |
src/lapi.js: lobject.luaO_str2num returns false if string is not a number
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lbaselib.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/lbaselib.js b/tests/lbaselib.js index 0a77e5b..ca83467 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -438,10 +438,14 @@ test('select', function (t) { test('tonumber', function (t) { let luaCode = ` - return tonumber('123'), tonumber('12.3'), tonumber('az', 36), tonumber('10', 2) + return tonumber('foo'), + tonumber('123'), + tonumber('12.3'), + tonumber('az', 36), + tonumber('10', 2) `, L; - - t.plan(5); + + t.plan(6); t.doesNotThrow(function () { @@ -457,6 +461,11 @@ test('tonumber', function (t) { }, "JS Lua program ran without error"); + t.ok( + lua.lua_isnil(L, -5), + "Correct element(s) on the stack" + ); + t.strictEqual( lua.lua_tonumber(L, -4), 123, |