diff options
author | daurnimator <quae@daurnimator.com> | 2017-06-16 18:01:22 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-06-16 18:06:52 +1000 |
commit | b805bbcae2ef9e08ef993b5c8b35a18dbb5a81d3 (patch) | |
tree | 341f4dd9dcf2bcb1677fbc2cfd233ab2bc981b06 | |
parent | 72466d7c73ca7659aca14d44c90e72fa0a0b83b8 (diff) | |
download | fengari-b805bbcae2ef9e08ef993b5c8b35a18dbb5a81d3.tar.gz fengari-b805bbcae2ef9e08ef993b5c8b35a18dbb5a81d3.tar.bz2 fengari-b805bbcae2ef9e08ef993b5c8b35a18dbb5a81d3.zip |
tests/test-suite/inprogress/db.js: Escape escapes
-rw-r--r-- | tests/test-suite/inprogress/db.js | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/tests/test-suite/inprogress/db.js b/tests/test-suite/inprogress/db.js index 0fd250b..b6ac68b 100644 --- a/tests/test-suite/inprogress/db.js +++ b/tests/test-suite/inprogress/db.js @@ -1259,42 +1259,39 @@ test("[test-suite] db: testing for-iterator name", function (t) { test("[test-suite] db: testing traceback sizes", function (t) { let luaCode = ` - do - local function countlines (s) - return select(2, string.gsub(s, "\n", "")) - end + local function countlines (s) + return select(2, string.gsub(s, "\\n", "")) + end - local function deep (lvl, n) - if lvl == 0 then - return (debug.traceback("message", n)) - else - return (deep(lvl-1, n)) - end + local function deep (lvl, n) + if lvl == 0 then + return (debug.traceback("message", n)) + else + return (deep(lvl-1, n)) end + end - local function checkdeep (total, start) - local s = deep(total, start) - local rest = string.match(s, "^message\nstack traceback:\n(.*)$") - local cl = countlines(rest) - -- at most 10 lines in first part, 11 in second, plus '...' - assert(cl <= 10 + 11 + 1) - local brk = string.find(rest, "%.%.%.") - if brk then -- does message have '...'? - local rest1 = string.sub(rest, 1, brk) - local rest2 = string.sub(rest, brk, #rest) - assert(countlines(rest1) == 10 and countlines(rest2) == 11) - else - assert(cl == total - start + 2) - end + local function checkdeep (total, start) + local s = deep(total, start) + local rest = string.match(s, "^message\\nstack traceback:\\n(.*)$") + local cl = countlines(rest) + -- at most 10 lines in first part, 11 in second, plus '...' + assert(cl <= 10 + 11 + 1) + local brk = string.find(rest, "%.%.%.") + if brk then -- does message have '...'? + local rest1 = string.sub(rest, 1, brk) + local rest2 = string.sub(rest, brk, #rest) + assert(countlines(rest1) == 10 and countlines(rest2) == 11) + else + assert(cl == total - start + 2) end + end - for d = 1, 51, 10 do - for l = 1, d do - -- use coroutines to ensure complete control of the stack - coroutine.wrap(checkdeep)(d, l) - end + for d = 1, 51, 10 do + for l = 1, d do + -- use coroutines to ensure complete control of the stack + coroutine.wrap(checkdeep)(d, l) end - end `, L; |