luatest
luatest copied to clipboard
Non-null value printed as [null] in assert_equals
reported by @imeevma
local server = require('test.luatest_helpers.server')
local t = require('luatest')
local g = t.group()
g.before_all(function()
g.server = server:new({alias = 'repro'})
g.server:start()
g.server:exec(function()
local s = box.schema.space.create('T', {format = {{'DEC', 'decimal'}}})
s:create_index('I')
end)
end)
g.after_all(function()
g.server:exec(function()
box.space.T:drop()
end)
g.server:stop()
end)
g.test_repro_1 = function()
g.server:exec(function()
local t = require('luatest')
local dec = require('decimal')
local s = box.space.T
s:insert({dec.new(1)})
-- must fail
t.assert_equals(s:select(), {{dec.new(2)}})
end)
end
output:
[001] sql-luatest/repro_test.lua [ fail ]
[001] Test failed! Output from reject file var/rejects/sql-luatest/repro.reject:
[001] TAP version 13
[001] 1..1
[001] # Started on Thu Mar 3 12:45:05 2022
[001] # Starting group: sql-luatest.repro
[001] not ok 1 sql-luatest.repro.test_repro_1
[001] # /home/mergen/work/dev/test/sql-luatest/repro_test.lua:27: expected: {{2}}
- [001] # actual: {[null]}
+ [001] # actual: {{1}}
[001] # stack traceback:
[001] # /home/mergen/work/dev/test/sql-luatest/repro_test.lua:22: in function 'sql-luatest.repro.test_repro_1'
[001] # ...
[001] # [C]: in function 'xpcall'
[001] # Ran 1 tests in 0.352 seconds, 0 succeeded, 1 failed