From 220089359979f419c4fc9446ca4ec7407d3e91e2 Mon Sep 17 00:00:00 2001 From: Kyle Grierson Date: Fri, 11 Aug 2023 19:20:47 +0100 Subject: [PATCH] just watch feature - mode --- fnl/formedit/api/motion.fnl | 3 +++ .../motion/motion_spec.fnl} | 5 ++++ justfile | 4 +-- lua/formedit/api/motion.lua | 5 ++++ lua/spec/nfnl/api/motion/motion_spec.lua | 26 +++++++++++++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 fnl/formedit/api/motion.fnl rename fnl/spec/nfnl/{cursor_spec.fnl => api/motion/motion_spec.fnl} (71%) create mode 100644 lua/formedit/api/motion.lua create mode 100644 lua/spec/nfnl/api/motion/motion_spec.lua diff --git a/fnl/formedit/api/motion.fnl b/fnl/formedit/api/motion.fnl new file mode 100644 index 0000000..be2f1c1 --- /dev/null +++ b/fnl/formedit/api/motion.fnl @@ -0,0 +1,3 @@ +(local {: autoload} (require :nfnl.module)) +(local notify (autoload :nfnl.notify)) + diff --git a/fnl/spec/nfnl/cursor_spec.fnl b/fnl/spec/nfnl/api/motion/motion_spec.fnl similarity index 71% rename from fnl/spec/nfnl/cursor_spec.fnl rename to fnl/spec/nfnl/api/motion/motion_spec.fnl index 8d8cf45..14eb08f 100644 --- a/fnl/spec/nfnl/cursor_spec.fnl +++ b/fnl/spec/nfnl/api/motion/motion_spec.fnl @@ -12,4 +12,9 @@ (fn [] (h.setup {:content "(a)" :cursor [1 2]}) (vim.api.nvim_win_set_cursor 0 [1 1]) + (h.expect {:content "(a)" :cursor [1 1]}))) + (it "no movement" + (fn [] + (h.setup {:content "(a)" :cursor [1 1]}) + (vim.api.nvim_win_set_cursor 0 [1 1]) (h.expect {:content "(a)" :cursor [1 1]}))))) diff --git a/justfile b/justfile index 3f5d79a..97bdca6 100644 --- a/justfile +++ b/justfile @@ -39,8 +39,8 @@ focus feature: prepare --headless \ --noplugin \ -u lua/spec/init.lua \ - -c "PlenaryBustedDirectory lua/spec/{{feature}} { minimal_init='lua/spec/init.lua', sequential=true }" + -c "PlenaryBustedDirectory lua/spec/nfnl/api/{{feature}} { minimal_init='lua/spec/init.lua', sequential=true }" watch feature: - fswatch -o lua/api/{{feature}}.lua lua/spec/api/{{feature}}/{{feature}}_spec.lua | xargs -n1 -I{} just focus {{feature}} + fswatch -o lua/formedit/api/{{feature}}.lua lua/spec/nfnl/api/{{feature}}/{{feature}}_spec.lua | xargs -n1 -I{} just focus {{feature}} diff --git a/lua/formedit/api/motion.lua b/lua/formedit/api/motion.lua new file mode 100644 index 0000000..3d0d206 --- /dev/null +++ b/lua/formedit/api/motion.lua @@ -0,0 +1,5 @@ +-- [nfnl] Compiled from fnl/formedit/api/motion.fnl by https://github.com/Olical/nfnl, do not edit. +local _local_1_ = require("nfnl.module") +local autoload = _local_1_["autoload"] +local notify = autoload("nfnl.notify") +return nil diff --git a/lua/spec/nfnl/api/motion/motion_spec.lua b/lua/spec/nfnl/api/motion/motion_spec.lua new file mode 100644 index 0000000..349de96 --- /dev/null +++ b/lua/spec/nfnl/api/motion/motion_spec.lua @@ -0,0 +1,26 @@ +-- [nfnl] Compiled from fnl/spec/nfnl/api/motion/motion_spec.fnl by https://github.com/Olical/nfnl, do not edit. +local _local_1_ = require("plenary.busted") +local describe = _local_1_["describe"] +local it = _local_1_["it"] +local h = require("spec.nfnl.helper") +local function _2_() + local function _3_() + h.setup({content = "(a)", cursor = {1, 1}}) + vim.api.nvim_win_set_cursor(0, {1, 2}) + return h.expect({content = "(a)", cursor = {1, 2}}) + end + it("forward", _3_) + local function _4_() + h.setup({content = "(a)", cursor = {1, 2}}) + vim.api.nvim_win_set_cursor(0, {1, 1}) + return h.expect({content = "(a)", cursor = {1, 1}}) + end + it("back", _4_) + local function _5_() + h.setup({content = "(a)", cursor = {1, 1}}) + vim.api.nvim_win_set_cursor(0, {1, 1}) + return h.expect({content = "(a)", cursor = {1, 1}}) + end + return it("no movement", _5_) +end +return describe("move cursor", _2_)