--- a/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua
+++ b/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua
@@ -2,7 +2,7 @@
local test = tap.test('gh-6976-narrowing-of-unary-minus')
test:plan(2)
-jit.opt.start('hotloop=1', 'hotexit=1')
+jit.opt.start('hotloop=1')
local function check(routine)
jit.off()
@@ -20,32 +20,29 @@
return true
end
-test:ok(
- check(
- function()
- local res = require('table.new')(3, 0)
- for _ = 1, 3 do
- local zero = 0
- zero = -zero
- table.insert(res, tostring(zero))
- end
- return res
- end
- ),
- 'incorrect recording for zero'
-)
-
-test:ok(
- check(
- function()
- local res = require('table.new')(3, 0)
- for i = 2, 0, -1 do
- table.insert(res, tostring(-i))
- end
- return res
- end
- ),
- 'assertion guard fail'
-)
+test:ok(check(function()
+ -- We use `table.new()` here to avoid trace
+ -- exits due to table rehashing.
+ local res = require('table.new')(3, 0)
+ for _ = 1, 3 do
+ local zero = 0
+ zero = -zero
+ -- There is no difference between 0 and -0 from
+ -- arithmetic perspective, unless you try to divide
+ -- something by them.
+ -- `1 / 0 = inf` and `1 / -0 = -inf`
+ table.insert(res, 1 / zero)
+ end
+ return res
+end), 'incorrect recording for zero')
+
+test:ok(check(function()
+ -- See the comment about `table.new()` above.
+ local res = require('table.new')(3, 0)
+ for i = 2, 0, -1 do
+ table.insert(res, 1 / -i)
+ end
+ return res
+end),'assertion guard fail')
os.exit(test:check() and 0 or 1)
===============================================
<snipped>