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/functional/script/luacats_grammar_spec.lua | 4 ++-- test/functional/script/luacats_parser_spec.lua | 4 ++-- test/functional/script/text_utils_spec.lua | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/functional/script') diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index c3ac9fe722..40a0f87594 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local eq = t.eq local grammar = require('scripts/luacats_grammar') diff --git a/test/functional/script/luacats_parser_spec.lua b/test/functional/script/luacats_parser_spec.lua index e10aa81003..ae23fd2648 100644 --- a/test/functional/script/luacats_parser_spec.lua +++ b/test/functional/script/luacats_parser_spec.lua @@ -1,5 +1,5 @@ -local helpers = require('test.functional.helpers')(after_each) -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local eq = t.eq local parser = require('scripts/luacats_parser') diff --git a/test/functional/script/text_utils_spec.lua b/test/functional/script/text_utils_spec.lua index 190c617e1d..5e6ea0f2a5 100644 --- a/test/functional/script/text_utils_spec.lua +++ b/test/functional/script/text_utils_spec.lua @@ -1,6 +1,6 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq local function md_to_vimdoc(text, start_indent, indent, text_width) return exec_lua( @@ -28,7 +28,7 @@ end describe('md_to_vimdoc', function() before_each(function() - helpers.clear() + t.clear() end) test('can render para after fenced code', { -- 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/functional/script/luacats_grammar_spec.lua | 2 +- test/functional/script/luacats_parser_spec.lua | 2 +- test/functional/script/text_utils_spec.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/script') diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index 40a0f87594..c6f0f868f0 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -1,4 +1,4 @@ -local t = require('test.functional.testutil')(after_each) +local t = require('test.functional.testutil')() local eq = t.eq local grammar = require('scripts/luacats_grammar') diff --git a/test/functional/script/luacats_parser_spec.lua b/test/functional/script/luacats_parser_spec.lua index ae23fd2648..e797a913ba 100644 --- a/test/functional/script/luacats_parser_spec.lua +++ b/test/functional/script/luacats_parser_spec.lua @@ -1,4 +1,4 @@ -local t = require('test.functional.testutil')(after_each) +local t = require('test.functional.testutil')() local eq = t.eq local parser = require('scripts/luacats_parser') diff --git a/test/functional/script/text_utils_spec.lua b/test/functional/script/text_utils_spec.lua index 5e6ea0f2a5..7c608c157c 100644 --- a/test/functional/script/text_utils_spec.lua +++ b/test/functional/script/text_utils_spec.lua @@ -1,4 +1,4 @@ -local t = require('test.functional.testutil')(after_each) +local t = require('test.functional.testutil')() local exec_lua = t.exec_lua local eq = t.eq -- cgit From 052498ed42780a76daea589d063cd8947a894673 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 20 Apr 2024 17:44:13 +0200 Subject: test: improve test conventions 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. --- test/functional/script/luacats_grammar_spec.lua | 3 ++- test/functional/script/luacats_parser_spec.lua | 3 ++- test/functional/script/text_utils_spec.lua | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'test/functional/script') diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index c6f0f868f0..2dd3ad8a78 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -1,4 +1,5 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') + local eq = t.eq local grammar = require('scripts/luacats_grammar') diff --git a/test/functional/script/luacats_parser_spec.lua b/test/functional/script/luacats_parser_spec.lua index e797a913ba..bc87b38eca 100644 --- a/test/functional/script/luacats_parser_spec.lua +++ b/test/functional/script/luacats_parser_spec.lua @@ -1,4 +1,5 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') + local eq = t.eq local parser = require('scripts/luacats_parser') diff --git a/test/functional/script/text_utils_spec.lua b/test/functional/script/text_utils_spec.lua index 7c608c157c..176c2ef816 100644 --- a/test/functional/script/text_utils_spec.lua +++ b/test/functional/script/text_utils_spec.lua @@ -1,5 +1,7 @@ -local t = require('test.functional.testutil')() -local exec_lua = t.exec_lua +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local exec_lua = n.exec_lua local eq = t.eq local function md_to_vimdoc(text, start_indent, indent, text_width) @@ -28,7 +30,7 @@ end describe('md_to_vimdoc', function() before_each(function() - t.clear() + n.clear() end) test('can render para after fenced code', { -- cgit From 93940af1d456ec52f39cb2912b5ffb8445d26c98 Mon Sep 17 00:00:00 2001 From: James Trew Date: Thu, 2 May 2024 23:33:22 -0400 Subject: docs(luacats): support backtick captured generic type Problem: While LuaCATS's generics system are still considered WIP by luals, they currently support type captured generics. See "Capture with Backtick" example: https://luals.github.io/wiki/annotations/#generic Solution: Add support for it in the LuaCATS grammar --- test/functional/script/luacats_grammar_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/functional/script') diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index 2dd3ad8a78..6d444e1888 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -152,4 +152,11 @@ describe('luacats grammar', function() name = '[1]', type = 'integer', }) + + test('@param type `T` this is a generic type', { + desc = 'this is a generic type', + kind = 'param', + name = 'type', + type = '`T`', + }) end) -- cgit