From 7035125b2b26aa68fcfb7cda39377ac79926a0f9 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 8 Apr 2024 11:03:20 +0200 Subject: test: improve test conventions Work on https://github.com/neovim/neovim/issues/27004. --- test/unit/strings_spec.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/unit/strings_spec.lua') diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index eea669c964..e686998e84 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr +local cimport = t.cimport +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr local strings = cimport('stdlib.h', './src/nvim/strings.h', './src/nvim/memory.h') @@ -261,7 +261,7 @@ end) describe('reverse_text', function() local reverse_text = function(str) - return helpers.internalize(strings.reverse_text(to_cstr(str))) + return t.internalize(strings.reverse_text(to_cstr(str))) end itp('handles empty string', function() -- cgit From 81fc27124b9e1b375e0ce9605ae69c3c2a2d9222 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 9 Apr 2024 12:26:16 +0100 Subject: refactor(test): inject after_each differently --- test/unit/strings_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/strings_spec.lua') diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index e686998e84..6e88f5141d 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -1,4 +1,4 @@ -local t = require('test.unit.testutil')(after_each) +local t = require('test.unit.testutil') local itp = t.gen_itp(it) local cimport = t.cimport -- cgit From f4c97da262424e0680e00c5e297da988937480e9 Mon Sep 17 00:00:00 2001 From: Joey Gouly Date: Fri, 12 Apr 2024 17:24:11 +0100 Subject: fix(test): fix strings_spec.lua for AArch64 LuaJIT does not handle -0.0 correctly in 'dual number mode' (which is the default, and only supported mode for LuaJIT arm64). If LuaJIT is forced to use 'dual number mode' on X64 (where the default is single), this test will fail in the same manner. Fix this by using tonumber("-0.0") instead of a -0.0 literal. See: https://github.com/LuaJIT/LuaJIT/issues/858 --- test/unit/strings_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/unit/strings_spec.lua') diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index 6e88f5141d..25cdc27b28 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -188,7 +188,7 @@ describe('vim_snprintf()', function() a('nan', buf, bsize, '%f', 0.0 / 0.0) a('inf', buf, bsize, '%f', 1.0 / 0.0) a('-inf', buf, bsize, '%f', -1.0 / 0.0) - a('-0.000000', buf, bsize, '%f', -0.0) + a('-0.000000', buf, bsize, '%f', tonumber('-0.0')) a('漢語', buf, bsize, '%s', '漢語') a(' 漢語', buf, bsize, '%8s', '漢語') a('漢語 ', buf, bsize, '%-8s', '漢語') @@ -233,7 +233,7 @@ describe('vim_snprintf()', function() a('nan', buf, bsize, '%1$f', 0.0 / 0.0) a('inf', buf, bsize, '%1$f', 1.0 / 0.0) a('-inf', buf, bsize, '%1$f', -1.0 / 0.0) - a('-0.000000', buf, bsize, '%1$f', -0.0) + a('-0.000000', buf, bsize, '%1$f', tonumber('-0.0')) end end) -- cgit