From 2630360420b041bb605e8e0ef8a192a7a2f35a07 Mon Sep 17 00:00:00 2001 From: Sergey Ostanevich <sergos@tarantool.org> Date: Wed, 24 Jul 2019 13:52:50 +0000 Subject: [PATCH] test: new test for LuaJIT fold machinery https://github.com/LuaJIT/LuaJIT/issues/505 --- test/luajit-tap/fold_bug_LuaJIT_505.test.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 test/luajit-tap/fold_bug_LuaJIT_505.test.lua diff --git a/test/luajit-tap/fold_bug_LuaJIT_505.test.lua b/test/luajit-tap/fold_bug_LuaJIT_505.test.lua new file mode 100755 index 0000000000..2fee069640 --- /dev/null +++ b/test/luajit-tap/fold_bug_LuaJIT_505.test.lua @@ -0,0 +1,20 @@ +#!/usr/bin/env tarantool + +tap = require('tap') + +test = tap.test("505") +test:plan(1) + +-- Test file to demonstrate Lua fold machinery icorrect behavior, details: +-- https://github.com/LuaJIT/LuaJIT/issues/505 + +jit.opt.start("hotloop=1") +for _ = 1, 20 do + local value = "abc" + local pos_c = string.find(value, "c", 1, true) + local value2 = string.sub(value, 1, pos_c - 1) + local pos_b = string.find(value2, "b", 2, true) + assert(pos_b == 2, "FAIL: position of 'b' is " .. pos_b) +end + +test:ok("PASS") -- GitLab