mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
052498ed42
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
31 lines
1009 B
Lua
31 lines
1009 B
Lua
local t = require('test.testutil')
|
|
local n = require('test.functional.testnvim')()
|
|
|
|
local eq = t.eq
|
|
local eval = n.eval
|
|
local clear = n.clear
|
|
|
|
describe('Division operator', function()
|
|
before_each(clear)
|
|
|
|
it('returns infinity on {positive}/0.0', function()
|
|
eq("str2float('inf')", eval('string(1.0/0.0)'))
|
|
eq("str2float('inf')", eval('string(1.0e-100/0.0)'))
|
|
eq("str2float('inf')", eval('string(1.0e+100/0.0)'))
|
|
eq("str2float('inf')", eval('string((1.0/0.0)/0.0)'))
|
|
end)
|
|
|
|
it('returns -infinity on {negative}/0.0', function()
|
|
eq("-str2float('inf')", eval('string((-1.0)/0.0)'))
|
|
eq("-str2float('inf')", eval('string((-1.0e-100)/0.0)'))
|
|
eq("-str2float('inf')", eval('string((-1.0e+100)/0.0)'))
|
|
eq("-str2float('inf')", eval('string((-1.0/0.0)/0.0)'))
|
|
end)
|
|
|
|
it('returns NaN on 0.0/0.0', function()
|
|
eq("str2float('nan')", eval('string(0.0/0.0)'))
|
|
eq("str2float('nan')", eval('string(-(0.0/0.0))'))
|
|
eq("str2float('nan')", eval('string((-0.0)/0.0)'))
|
|
end)
|
|
end)
|