From b4b64125057491aa4cba2e7d9506959b3238adbc Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 24 Mar 2024 12:07:34 +0100 Subject: [PATCH] plugins/comment: add tests --- tests/test-sources/plugins/utils/comment.nix | 61 ++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/test-sources/plugins/utils/comment.nix diff --git a/tests/test-sources/plugins/utils/comment.nix b/tests/test-sources/plugins/utils/comment.nix new file mode 100644 index 00000000..e7997c82 --- /dev/null +++ b/tests/test-sources/plugins/utils/comment.nix @@ -0,0 +1,61 @@ +{ + empty = { + plugins.comment.enable = true; + }; + + defaults = { + plugins.comment = { + enable = true; + + settings = { + padding = true; + sticky = true; + ignore = null; + toggler = { + line = "gcc"; + block = "gbc"; + }; + opleader = { + line = "gc"; + block = "gb"; + }; + extra = { + above = "gcO"; + below = "gco"; + eol = "gcA"; + }; + mappings = { + basic = true; + extra = true; + }; + pre_hook = null; + post_hook = null; + }; + }; + }; + + example = { + plugins = { + treesitter.enable = true; + ts-context-commentstring.enable = true; + + comment = { + enable = true; + + settings = { + ignore = "^const(.*)=(%s?)%((.*)%)(%s?)=>"; + pre_hook = "require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()"; + post_hook = '' + function(ctx) + if ctx.range.srow == ctx.range.erow then + -- do something with the current line + else + -- do something with lines range + end + end + ''; + }; + }; + }; + }; +}