From 1d1a7fc066086ff507ff10ba09ad232a4bbf556d Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Sun, 16 Jun 2024 17:01:23 -0700 Subject: [PATCH 1/8] Add powershell script equivalents of test scripts and add windows to the test matrix for the test pipeline --- .github/workflows/test.yaml | 2 +- script/setup-test-deps.ps1 | 10 ++++++++++ script/test.ps1 | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 script/setup-test-deps.ps1 create mode 100644 script/test.ps1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 61f66e4..503d91c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: [ push ] jobs: test: - runs-on: ubuntu-latest + runs-on: [windows-latest, ubuntu-latest] strategy: matrix: neovim-version: [ "v0.9.0", "v0.9.1", "stable", "nightly" ] diff --git a/script/setup-test-deps.ps1 b/script/setup-test-deps.ps1 new file mode 100644 index 0000000..4a23b82 --- /dev/null +++ b/script/setup-test-deps.ps1 @@ -0,0 +1,10 @@ + +$PACK_DIR = "./.test-config/nvim/pack/nfnl-tests/start" + +mkdir $PACK_DIR -erroraction 'silentlycontinue' +git clone https://github.com/nvim-lua/plenary.nvim.git $PACK_DIR/plenary.nvim +git clone https://github.com/nvim-lua/plenary.nvim.git $PACK_DIR/fennel.vim + +$LINK_TARGET = $GITHUB_WORKSPACE ?? $PWD +echo $LINK_TARGET +new-item -path $PACK_DIR/nfnl -itemtype Junction -value $LINK_TARGET -force diff --git a/script/test.ps1 b/script/test.ps1 new file mode 100644 index 0000000..08640ae --- /dev/null +++ b/script/test.ps1 @@ -0,0 +1,4 @@ +$env:XDG_CONFIG_HOME = "$PWD/.test-config" + +nvim --headless -c 'edit .nfnl.fnl' -c trust -c qa +nvim --headless -c 'PlenaryBustedDirectory lua/spec' From 888237f5084ec5ba60df90d5062b8411eec4277a Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Sun, 16 Jun 2024 17:47:25 -0700 Subject: [PATCH 2/8] Fix some simple path separator test false negatives --- fnl/spec/nfnl/config_spec.fnl | 4 +- fnl/spec/nfnl/fs_spec.fnl | 31 +++++++++++---- lua/spec/nfnl/config_spec.lua | 16 +++++--- lua/spec/nfnl/fs_spec.lua | 73 +++++++++++++++++++++++------------ 4 files changed, 84 insertions(+), 40 deletions(-) diff --git a/fnl/spec/nfnl/config_spec.fnl b/fnl/spec/nfnl/config_spec.fnl index 8110ecd..d5bce9a 100644 --- a/fnl/spec/nfnl/config_spec.fnl +++ b/fnl/spec/nfnl/config_spec.fnl @@ -45,7 +45,9 @@ (it "returns an empty table if a config file isn't found" (fn [] - (assert.are.same {} (config.find-and-load "/some/made/up/dir")))))) + (if (= jit.os "Windows") + (assert.are.same {} (config.find-and-load "\\some\\made\\up\\dir")) + (assert.are.same {} (config.find-and-load "/some/made/up/dir"))))))) (fn sorted [xs] (table.sort xs) diff --git a/fnl/spec/nfnl/fs_spec.fnl b/fnl/spec/nfnl/fs_spec.fnl index 85eb70d..db88108 100644 --- a/fnl/spec/nfnl/fs_spec.fnl +++ b/fnl/spec/nfnl/fs_spec.fnl @@ -2,6 +2,9 @@ (local assert (require :luassert.assert)) (local fs (require :nfnl.fs)) +(fn windows [] + (= jit.os "Windows")) + (describe "basename" (fn [] @@ -20,7 +23,9 @@ (fn [] (it "returns the OS path separator (test assumes Linux)" (fn [] - (assert.equals "/" (fs.path-sep)))))) + (if (windows) + (assert.equals "\\" (fs.path-sep)) + (assert.equals "/" (fs.path-sep))))))) (describe "replace-extension" @@ -34,22 +39,32 @@ (fn [] (it "splits a path into parts" (fn [] - (assert.are.same ["foo" "bar" "baz"] (fs.split-path "foo/bar/baz")) - (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path "/foo/bar/baz")))))) + (if (windows) + (do (assert.are.same ["foo" "bar" "baz"] (fs.split-path "foo\\bar\\baz")) + (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path "\\foo\\bar\\baz"))) + (do (assert.are.same ["foo" "bar" "baz"] (fs.split-path "foo/bar/baz")) + (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path "/foo/bar/baz")))))))) (describe "join-path" (fn [] (it "joins a path together" (fn [] - (assert.equals "foo/bar/baz" (fs.join-path ["foo" "bar" "baz"])) - (assert.equals "/foo/bar/baz" (fs.join-path ["" "foo" "bar" "baz"])))))) + (if (windows) + (do (assert.equals "foo\\bar\\baz" (fs.join-path ["foo" "bar" "baz"])) + (assert.equals "\\foo\\bar\\baz" (fs.join-path ["" "foo" "bar" "baz"]))) + (do (assert.equals "foo/bar/baz" (fs.join-path ["foo" "bar" "baz"])) + (assert.equals "/foo/bar/baz" (fs.join-path ["" "foo" "bar" "baz"])))))))) (describe "replace-dirs" (fn [] (it "replaces directories in a path that match a string with another string" (fn [] - (assert.equals "foo/lua/bar" (fs.replace-dirs "foo/fnl/bar" "fnl" "lua")) - (assert.equals "/foo/lua/bar" (fs.replace-dirs "/foo/fnl/bar" "fnl" "lua")) - (assert.equals "/foo/nfnl/bar" (fs.replace-dirs "/foo/nfnl/bar" "fnl" "lua")))))) + (if (windows) + (do (assert.equals "foo\\lua\\bar" (fs.replace-dirs "foo\\fnl\\bar" "fnl" "lua")) + (assert.equals "\\foo\\lua\\bar" (fs.replace-dirs "\\foo\\fnl\\bar" "fnl" "lua")) + (assert.equals "\\foo\\nfnl\\bar" (fs.replace-dirs "\\foo\\nfnl\\bar" "fnl" "lua"))) + (do (assert.equals "foo/lua/bar" (fs.replace-dirs "foo/fnl/bar" "fnl" "lua")) + (assert.equals "/foo/lua/bar" (fs.replace-dirs "/foo/fnl/bar" "fnl" "lua")) + (assert.equals "/foo/nfnl/bar" (fs.replace-dirs "/foo/nfnl/bar" "fnl" "lua")))))))) diff --git a/lua/spec/nfnl/config_spec.lua b/lua/spec/nfnl/config_spec.lua index 289b3f0..4859ca3 100644 --- a/lua/spec/nfnl/config_spec.lua +++ b/lua/spec/nfnl/config_spec.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/spec/nfnl/config_spec.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\spec\nfnl\config_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"] @@ -46,7 +46,11 @@ local function _8_() end it("loads the repo config file", _9_) local function _11_() - return assert.are.same({}, config["find-and-load"]("/some/made/up/dir")) + if (jit.os == "Windows") then + return assert.are.same({}, config["find-and-load"]("\\some\\made\\up\\dir")) + else + return assert.are.same({}, config["find-and-load"]("/some/made/up/dir")) + end end return it("returns an empty table if a config file isn't found", _11_) end @@ -55,11 +59,11 @@ local function sorted(xs) table.sort(xs) return xs end -local function _12_() - local function _13_() +local function _13_() + local function _14_() assert.are.same({"/foo/bar/nfnl", "/foo/baz/my-proj"}, sorted(config["path-dirs"]({runtimepath = "/foo/bar/nfnl,/foo/bar/other-thing", ["rtp-patterns"] = {(fs["path-sep"]() .. "nfnl$")}, ["base-dirs"] = {"/foo/baz/my-proj"}}))) return assert.are.same({"/foo/bar/nfnl", "/foo/baz/my-proj"}, sorted(config["path-dirs"]({runtimepath = "/foo/bar/nfnl,/foo/bar/other-thing", ["rtp-patterns"] = {(fs["path-sep"]() .. "nfnl$")}, ["base-dirs"] = {"/foo/baz/my-proj", "/foo/bar/nfnl"}}))) end - return it("builds path dirs from runtimepath, deduplicates the base-dirs", _13_) + return it("builds path dirs from runtimepath, deduplicates the base-dirs", _14_) end -return describe("path-dirs", _12_) +return describe("path-dirs", _13_) diff --git a/lua/spec/nfnl/fs_spec.lua b/lua/spec/nfnl/fs_spec.lua index 215998e..64817d3 100644 --- a/lua/spec/nfnl/fs_spec.lua +++ b/lua/spec/nfnl/fs_spec.lua @@ -1,9 +1,12 @@ --- [nfnl] Compiled from fnl/spec/nfnl/fs_spec.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\spec\nfnl\fs_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 assert = require("luassert.assert") local fs = require("nfnl.fs") +local function windows() + return (jit.os == "Windows") +end local function _2_() local function _3_() assert.equals("foo", fs.basename("foo/bar.fnl")) @@ -19,40 +22,60 @@ end describe("basename", _2_) local function _5_() local function _6_() - return assert.equals("/", fs["path-sep"]()) + if windows() then + return assert.equals("\\", fs["path-sep"]()) + else + return assert.equals("/", fs["path-sep"]()) + end end return it("returns the OS path separator (test assumes Linux)", _6_) end describe("path-sep", _5_) -local function _7_() - local function _8_() +local function _8_() + local function _9_() return assert.equals("foo.lua", fs["replace-extension"]("foo.fnl", "lua")) end - return it("replaces extensions", _8_) -end -describe("replace-extension", _7_) -local function _9_() - local function _10_() - assert.are.same({"foo", "bar", "baz"}, fs["split-path"]("foo/bar/baz")) - return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"]("/foo/bar/baz")) - end - return it("splits a path into parts", _10_) + return it("replaces extensions", _9_) end -describe("split-path", _9_) -local function _11_() - local function _12_() - assert.equals("foo/bar/baz", fs["join-path"]({"foo", "bar", "baz"})) - return assert.equals("/foo/bar/baz", fs["join-path"]({"", "foo", "bar", "baz"})) +describe("replace-extension", _8_) +local function _10_() + local function _11_() + if windows() then + assert.are.same({"foo", "bar", "baz"}, fs["split-path"]("foo\\bar\\baz")) + return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"]("\\foo\\bar\\baz")) + else + assert.are.same({"foo", "bar", "baz"}, fs["split-path"]("foo/bar/baz")) + return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"]("/foo/bar/baz")) + end end - return it("joins a path together", _12_) + return it("splits a path into parts", _11_) end -describe("join-path", _11_) +describe("split-path", _10_) local function _13_() local function _14_() - assert.equals("foo/lua/bar", fs["replace-dirs"]("foo/fnl/bar", "fnl", "lua")) - assert.equals("/foo/lua/bar", fs["replace-dirs"]("/foo/fnl/bar", "fnl", "lua")) - return assert.equals("/foo/nfnl/bar", fs["replace-dirs"]("/foo/nfnl/bar", "fnl", "lua")) + if windows() then + assert.equals("foo\\bar\\baz", fs["join-path"]({"foo", "bar", "baz"})) + return assert.equals("\\foo\\bar\\baz", fs["join-path"]({"", "foo", "bar", "baz"})) + else + assert.equals("foo/bar/baz", fs["join-path"]({"foo", "bar", "baz"})) + return assert.equals("/foo/bar/baz", fs["join-path"]({"", "foo", "bar", "baz"})) + end + end + return it("joins a path together", _14_) +end +describe("join-path", _13_) +local function _16_() + local function _17_() + if windows() then + assert.equals("foo\\lua\\bar", fs["replace-dirs"]("foo\\fnl\\bar", "fnl", "lua")) + assert.equals("\\foo\\lua\\bar", fs["replace-dirs"]("\\foo\\fnl\\bar", "fnl", "lua")) + return assert.equals("\\foo\\nfnl\\bar", fs["replace-dirs"]("\\foo\\nfnl\\bar", "fnl", "lua")) + else + assert.equals("foo/lua/bar", fs["replace-dirs"]("foo/fnl/bar", "fnl", "lua")) + assert.equals("/foo/lua/bar", fs["replace-dirs"]("/foo/fnl/bar", "fnl", "lua")) + return assert.equals("/foo/nfnl/bar", fs["replace-dirs"]("/foo/nfnl/bar", "fnl", "lua")) + end end - return it("replaces directories in a path that match a string with another string", _14_) + return it("replaces directories in a path that match a string with another string", _17_) end -return describe("replace-dirs", _13_) +return describe("replace-dirs", _16_) From 52de01c83fc317445474da65b81d411e263ee134 Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 11:19:54 -0700 Subject: [PATCH 3/8] move os choice to matrix --- .github/workflows/test.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 503d91c..934a4b9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,10 +4,12 @@ on: [ push ] jobs: test: - runs-on: [windows-latest, ubuntu-latest] strategy: matrix: neovim-version: [ "v0.9.0", "v0.9.1", "stable", "nightly" ] + os: [ windows-latest, ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v3 From df8678c1b49ec58a20831d71bae3920186f48455 Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 11:26:57 -0700 Subject: [PATCH 4/8] swap to cross platform neovim installation --- .github/workflows/test.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 934a4b9..b04c638 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,13 +9,12 @@ jobs: neovim-version: [ "v0.9.0", "v0.9.1", "stable", "nightly" ] os: [ windows-latest, ubuntu-latest ] runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - uses: MunifTanjim/setup-neovim-action@v1 + - uses: actions/checkout@v4 + - uses: rhysd/action-setup-vim@v1 with: - tag: ${{ matrix.neovim-version }} + neovim: true + version: ${{ matrix.neovim-version }} - name: Install Neovim plugins run: | ./script/setup-test-deps From 7a6c73fdd8e4d0ac427d855c29171489b46074f1 Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 11:43:36 -0700 Subject: [PATCH 5/8] Standardize the header path separators --- fnl/nfnl/compile.fnl | 3 ++- fnl/nfnl/fs.fnl | 7 ++++++- fnl/nfnl/string.fnl | 7 ++++++- lua/nfnl/compile.lua | 5 +++-- lua/nfnl/fs.lua | 7 +++++-- lua/nfnl/string.lua | 7 +++++-- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/fnl/nfnl/compile.fnl b/fnl/nfnl/compile.fnl index 046b059..7e6c17b 100644 --- a/fnl/nfnl/compile.fnl +++ b/fnl/nfnl/compile.fnl @@ -10,7 +10,8 @@ (local header-marker "[nfnl]") (fn with-header [file src] - (.. "-- " header-marker " Compiled from " file " by https://github.com/Olical/nfnl, do not edit.\n" src)) + (let [file (fs.standardize-path file)] ;; Normalize the path for Windows + (.. "-- " header-marker " Compiled from " file " by https://github.com/Olical/nfnl, do not edit.\n" src))) (fn safe-target? [path] "Reads the given file and checks if it contains our header marker on the diff --git a/fnl/nfnl/fs.fnl b/fnl/nfnl/fs.fnl index 87ec065..42c823e 100644 --- a/fnl/nfnl/fs.fnl +++ b/fnl/nfnl/fs.fnl @@ -93,6 +93,10 @@ (replace-extension "lua") (replace-dirs "fnl" "lua"))) +(fn standardize-path [path] + "Replaces all non standard path separators with the standard forward slash" + (str.replace path "\\" "/")) + {: basename : filename : file-name-root @@ -108,4 +112,5 @@ : join-path : read-first-line : replace-dirs - : fnl-path->lua-path} + : fnl-path->lua-path + : standardize-path} diff --git a/fnl/nfnl/string.fnl b/fnl/nfnl/string.fnl index dbda7a4..b01758b 100644 --- a/fnl/nfnl/string.fnl +++ b/fnl/nfnl/string.fnl @@ -66,10 +66,15 @@ (= suffix (string.sub s (- s-len suffix-len -1))) false))) +(fn replace [s from to] + "Replace all occurrences of from with to in the string." + (string.gsub s from to)) + {: join : split : blank? : triml : trimr : trim - : ends-with?} + : ends-with? + : replace} diff --git a/lua/nfnl/compile.lua b/lua/nfnl/compile.lua index 63fdbb3..c34a536 100644 --- a/lua/nfnl/compile.lua +++ b/lua/nfnl/compile.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/nfnl/compile.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\nfnl\compile.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("nfnl.module") local autoload = _local_1_["autoload"] local core = autoload("nfnl.core") @@ -9,7 +9,8 @@ local config = autoload("nfnl.config") local mod = {} local header_marker = "[nfnl]" local function with_header(file, src) - return ("-- " .. header_marker .. " Compiled from " .. file .. " by https://github.com/Olical/nfnl, do not edit.\n" .. src) + local file0 = fs["standardize-path"](file) + return ("-- " .. header_marker .. " Compiled from " .. file0 .. " by https://github.com/Olical/nfnl, do not edit.\n" .. src) end local function safe_target_3f(path) local header = fs["read-first-line"](path) diff --git a/lua/nfnl/fs.lua b/lua/nfnl/fs.lua index 526aad1..e304dd6 100644 --- a/lua/nfnl/fs.lua +++ b/lua/nfnl/fs.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/nfnl/fs.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\nfnl\fs.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("nfnl.module") local autoload = _local_1_["autoload"] local core = autoload("nfnl.core") @@ -110,4 +110,7 @@ end local function fnl_path__3elua_path(fnl_path) return replace_dirs(replace_extension(fnl_path, "lua"), "fnl", "lua") end -return {basename = basename, filename = filename, ["file-name-root"] = file_name_root, ["full-path"] = full_path, mkdirp = mkdirp, ["replace-extension"] = replace_extension, absglob = absglob, relglob = relglob, ["glob-dir-newer?"] = glob_dir_newer_3f, ["path-sep"] = path_sep, findfile = findfile, ["split-path"] = split_path, ["join-path"] = join_path, ["read-first-line"] = read_first_line, ["replace-dirs"] = replace_dirs, ["fnl-path->lua-path"] = fnl_path__3elua_path} +local function standardize_path(path) + return str.replace(path, "\\", "/") +end +return {basename = basename, filename = filename, ["file-name-root"] = file_name_root, ["full-path"] = full_path, mkdirp = mkdirp, ["replace-extension"] = replace_extension, absglob = absglob, relglob = relglob, ["glob-dir-newer?"] = glob_dir_newer_3f, ["path-sep"] = path_sep, findfile = findfile, ["split-path"] = split_path, ["join-path"] = join_path, ["read-first-line"] = read_first_line, ["replace-dirs"] = replace_dirs, ["fnl-path->lua-path"] = fnl_path__3elua_path, ["standardize-path"] = standardize_path} diff --git a/lua/nfnl/string.lua b/lua/nfnl/string.lua index c0de95a..f0ca292 100644 --- a/lua/nfnl/string.lua +++ b/lua/nfnl/string.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/nfnl/string.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\nfnl\string.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("nfnl.module") local autoload = _local_1_["autoload"] local core = autoload("nfnl.core") @@ -73,4 +73,7 @@ local function ends_with_3f(s, suffix) return false end end -return {join = join, split = split, ["blank?"] = blank_3f, triml = triml, trimr = trimr, trim = trim, ["ends-with?"] = ends_with_3f} +local function replace(s, from, to) + return string.gsub(s, from, to) +end +return {join = join, split = split, ["blank?"] = blank_3f, triml = triml, trimr = trimr, trim = trim, ["ends-with?"] = ends_with_3f, replace = replace} From b63b4ab108c39dba47e7eba29ee9d2f32b9df36e Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 12:49:13 -0700 Subject: [PATCH 6/8] Reduce branching in fs tests --- fnl/nfnl/fs.fnl | 8 ++++- fnl/spec/nfnl/fs_spec.fnl | 58 ++++++++++++++++++-------------- lua/nfnl/fs.lua | 6 +++- lua/spec/nfnl/fs_spec.lua | 69 +++++++++++++++++++++------------------ script/test.ps1 | 4 +-- 5 files changed, 84 insertions(+), 61 deletions(-) diff --git a/fnl/nfnl/fs.fnl b/fnl/nfnl/fs.fnl index 42c823e..436d6ce 100644 --- a/fnl/nfnl/fs.fnl +++ b/fnl/nfnl/fs.fnl @@ -97,6 +97,11 @@ "Replaces all non standard path separators with the standard forward slash" (str.replace path "\\" "/")) +(fn correct-separators [path] + "Replaces all path separators with the ones appropriate for this system" + (str.replace path "\\" (path-sep)) + (str.replace path "/" (path-sep))) + {: basename : filename : file-name-root @@ -113,4 +118,5 @@ : read-first-line : replace-dirs : fnl-path->lua-path - : standardize-path} + : standardize-path + : correct-separators} diff --git a/fnl/spec/nfnl/fs_spec.fnl b/fnl/spec/nfnl/fs_spec.fnl index db88108..4b0b29c 100644 --- a/fnl/spec/nfnl/fs_spec.fnl +++ b/fnl/spec/nfnl/fs_spec.fnl @@ -2,16 +2,15 @@ (local assert (require :luassert.assert)) (local fs (require :nfnl.fs)) -(fn windows [] - (= jit.os "Windows")) +(fn windows? [] (= jit.os "Windows")) (describe "basename" (fn [] (it "removes the last segment of a path" (fn [] - (assert.equals "foo" (fs.basename "foo/bar.fnl")) - (assert.equals "foo/bar" (fs.basename "foo/bar/baz.fnl")) + (assert.equals "foo" (fs.basename (fs.join-path ["foo" "bar.fnl"]))) + (assert.equals (fs.join-path ["foo" "bar"]) (fs.basename (fs.join-path ["foo" "bar" "baz.fnl"]))) (assert.equals "." (fs.basename "baz.fnl")))) (it "happily lets nils flow back out" @@ -21,11 +20,11 @@ (describe "path-sep" (fn [] - (it "returns the OS path separator (test assumes Linux)" + (it "returns the OS path separator" (fn [] - (if (windows) - (assert.equals "\\" (fs.path-sep)) - (assert.equals "/" (fs.path-sep))))))) + (if (windows?) + (assert.equals "\\" (fs.path-sep)) + (assert.equals "/" (fs.path-sep))))))) (describe "replace-extension" @@ -39,32 +38,41 @@ (fn [] (it "splits a path into parts" (fn [] - (if (windows) - (do (assert.are.same ["foo" "bar" "baz"] (fs.split-path "foo\\bar\\baz")) - (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path "\\foo\\bar\\baz"))) - (do (assert.are.same ["foo" "bar" "baz"] (fs.split-path "foo/bar/baz")) - (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path "/foo/bar/baz")))))))) + (assert.are.same ["foo" "bar" "baz"] (fs.split-path (fs.correct-separators "foo/bar/baz"))z) + (assert.are.same ["" "foo" "bar" "baz"] (fs.split-path (fs.correct-separators "/foo/bar/baz"))))))) (describe "join-path" (fn [] (it "joins a path together" (fn [] - (if (windows) - (do (assert.equals "foo\\bar\\baz" (fs.join-path ["foo" "bar" "baz"])) - (assert.equals "\\foo\\bar\\baz" (fs.join-path ["" "foo" "bar" "baz"]))) - (do (assert.equals "foo/bar/baz" (fs.join-path ["foo" "bar" "baz"])) - (assert.equals "/foo/bar/baz" (fs.join-path ["" "foo" "bar" "baz"])))))))) + (assert.equals "foo/bar/baz" (fs.standardize-path (fs.join-path ["foo" "bar" "baz"]))) + (assert.equals "/foo/bar/baz" (fs.standardize-path (fs.join-path ["" "foo" "bar" "baz"]))))))) (describe "replace-dirs" (fn [] (it "replaces directories in a path that match a string with another string" (fn [] - (if (windows) - (do (assert.equals "foo\\lua\\bar" (fs.replace-dirs "foo\\fnl\\bar" "fnl" "lua")) - (assert.equals "\\foo\\lua\\bar" (fs.replace-dirs "\\foo\\fnl\\bar" "fnl" "lua")) - (assert.equals "\\foo\\nfnl\\bar" (fs.replace-dirs "\\foo\\nfnl\\bar" "fnl" "lua"))) - (do (assert.equals "foo/lua/bar" (fs.replace-dirs "foo/fnl/bar" "fnl" "lua")) - (assert.equals "/foo/lua/bar" (fs.replace-dirs "/foo/fnl/bar" "fnl" "lua")) - (assert.equals "/foo/nfnl/bar" (fs.replace-dirs "/foo/nfnl/bar" "fnl" "lua")))))))) + (assert.equals "foo/lua/bar" (fs.standardize-path (fs.replace-dirs (fs.correct-separators "foo/fnl/bar") "fnl" "lua"))) + (assert.equals "/foo/lua/bar" (fs.standardize-path (fs.replace-dirs (fs.correct-separators "/foo/fnl/bar") "fnl" "lua"))) + (assert.equals "/foo/nfnl/bar" (fs.standardize-path (fs.replace-dirs "/foo/nfnl/bar" "fnl" "lua"))))))) + +(describe + "standardize-path" + (fn [] + (it "replaces all path separators with forward slash" + (fn [] + (assert.equals "foo/bar/baz.fnl" (fs.standardize-path "foo\\bar\\baz.fnl")) + (assert.equals "foo/bar/baz.fnl" (fs.standardize-path "foo/bar/baz.fnl")))))) + +(describe + "correct-separators" + (fn [] + (it "" + (fn [] + (if (windows?) + (do (assert.equals "foo\\bar\\baz.fnl" (fs.correct-separators "foo/bar/baz.fnl")) + (assert.equals "foo\\bar\\baz.fnl" (fs.correct-separators "foo\\bar\\baz.fnl"))) + (do (assert.equals "foo/bar/baz.fnl" (fs.correct-separators "foo/bar/baz.fnl")) + (assert.equals "foo/bar/baz.fnl" (fs.correct-separators "foo\\bar\\baz.fnl")))))))) diff --git a/lua/nfnl/fs.lua b/lua/nfnl/fs.lua index e304dd6..2459038 100644 --- a/lua/nfnl/fs.lua +++ b/lua/nfnl/fs.lua @@ -113,4 +113,8 @@ end local function standardize_path(path) return str.replace(path, "\\", "/") end -return {basename = basename, filename = filename, ["file-name-root"] = file_name_root, ["full-path"] = full_path, mkdirp = mkdirp, ["replace-extension"] = replace_extension, absglob = absglob, relglob = relglob, ["glob-dir-newer?"] = glob_dir_newer_3f, ["path-sep"] = path_sep, findfile = findfile, ["split-path"] = split_path, ["join-path"] = join_path, ["read-first-line"] = read_first_line, ["replace-dirs"] = replace_dirs, ["fnl-path->lua-path"] = fnl_path__3elua_path, ["standardize-path"] = standardize_path} +local function correct_separators(path) + str.replace(path, "\\", path_sep()) + return str.replace(path, "/", path_sep()) +end +return {basename = basename, filename = filename, ["file-name-root"] = file_name_root, ["full-path"] = full_path, mkdirp = mkdirp, ["replace-extension"] = replace_extension, absglob = absglob, relglob = relglob, ["glob-dir-newer?"] = glob_dir_newer_3f, ["path-sep"] = path_sep, findfile = findfile, ["split-path"] = split_path, ["join-path"] = join_path, ["read-first-line"] = read_first_line, ["replace-dirs"] = replace_dirs, ["fnl-path->lua-path"] = fnl_path__3elua_path, ["standardize-path"] = standardize_path, ["correct-separators"] = correct_separators} diff --git a/lua/spec/nfnl/fs_spec.lua b/lua/spec/nfnl/fs_spec.lua index 64817d3..1fce54a 100644 --- a/lua/spec/nfnl/fs_spec.lua +++ b/lua/spec/nfnl/fs_spec.lua @@ -4,13 +4,13 @@ local describe = _local_1_["describe"] local it = _local_1_["it"] local assert = require("luassert.assert") local fs = require("nfnl.fs") -local function windows() +local function windows_3f() return (jit.os == "Windows") end local function _2_() local function _3_() - assert.equals("foo", fs.basename("foo/bar.fnl")) - assert.equals("foo/bar", fs.basename("foo/bar/baz.fnl")) + assert.equals("foo", fs.basename(fs["join-path"]({"foo", "bar.fnl"}))) + assert.equals(fs["join-path"]({"foo", "bar"}), fs.basename(fs["join-path"]({"foo", "bar", "baz.fnl"}))) return assert.equals(".", fs.basename("baz.fnl")) end it("removes the last segment of a path", _3_) @@ -22,13 +22,13 @@ end describe("basename", _2_) local function _5_() local function _6_() - if windows() then + if windows_3f() then return assert.equals("\\", fs["path-sep"]()) else return assert.equals("/", fs["path-sep"]()) end end - return it("returns the OS path separator (test assumes Linux)", _6_) + return it("returns the OS path separator", _6_) end describe("path-sep", _5_) local function _8_() @@ -40,42 +40,47 @@ end describe("replace-extension", _8_) local function _10_() local function _11_() - if windows() then - assert.are.same({"foo", "bar", "baz"}, fs["split-path"]("foo\\bar\\baz")) - return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"]("\\foo\\bar\\baz")) - else - assert.are.same({"foo", "bar", "baz"}, fs["split-path"]("foo/bar/baz")) - return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"]("/foo/bar/baz")) - end + assert.are.same({"foo", "bar", "baz"}, fs["split-path"](fs["correct-separators"]("foo/bar/baz")), z) + return assert.are.same({"", "foo", "bar", "baz"}, fs["split-path"](fs["correct-separators"]("/foo/bar/baz"))) end return it("splits a path into parts", _11_) end describe("split-path", _10_) -local function _13_() - local function _14_() - if windows() then - assert.equals("foo\\bar\\baz", fs["join-path"]({"foo", "bar", "baz"})) - return assert.equals("\\foo\\bar\\baz", fs["join-path"]({"", "foo", "bar", "baz"})) - else - assert.equals("foo/bar/baz", fs["join-path"]({"foo", "bar", "baz"})) - return assert.equals("/foo/bar/baz", fs["join-path"]({"", "foo", "bar", "baz"})) - end +local function _12_() + local function _13_() + assert.equals("foo/bar/baz", fs["standardize-path"](fs["join-path"]({"foo", "bar", "baz"}))) + return assert.equals("/foo/bar/baz", fs["standardize-path"](fs["join-path"]({"", "foo", "bar", "baz"}))) end - return it("joins a path together", _14_) + return it("joins a path together", _13_) end -describe("join-path", _13_) +describe("join-path", _12_) +local function _14_() + local function _15_() + assert.equals("foo/lua/bar", fs["standardize-path"](fs["replace-dirs"](fs["correct-separators"]("foo/fnl/bar"), "fnl", "lua"))) + assert.equals("/foo/lua/bar", fs["standardize-path"](fs["replace-dirs"](fs["correct-separators"]("/foo/fnl/bar"), "fnl", "lua"))) + return assert.equals("/foo/nfnl/bar", fs["standardize-path"](fs["replace-dirs"]("/foo/nfnl/bar", "fnl", "lua"))) + end + return it("replaces directories in a path that match a string with another string", _15_) +end +describe("replace-dirs", _14_) local function _16_() local function _17_() - if windows() then - assert.equals("foo\\lua\\bar", fs["replace-dirs"]("foo\\fnl\\bar", "fnl", "lua")) - assert.equals("\\foo\\lua\\bar", fs["replace-dirs"]("\\foo\\fnl\\bar", "fnl", "lua")) - return assert.equals("\\foo\\nfnl\\bar", fs["replace-dirs"]("\\foo\\nfnl\\bar", "fnl", "lua")) + assert.equals("foo/bar/baz.fnl", fs["standardize-path"]("foo\\bar\\baz.fnl")) + return assert.equals("foo/bar/baz.fnl", fs["standardize-path"]("foo/bar/baz.fnl")) + end + return it("replaces all path separators with forward slash", _17_) +end +describe("standardize-path", _16_) +local function _18_() + local function _19_() + if windows_3f() then + assert.equals("foo\\bar\\baz.fnl", fs["correct-separators"]("foo/bar/baz.fnl")) + return assert.equals("foo\\bar\\baz.fnl", fs["correct-separators"]("foo\\bar\\baz.fnl")) else - assert.equals("foo/lua/bar", fs["replace-dirs"]("foo/fnl/bar", "fnl", "lua")) - assert.equals("/foo/lua/bar", fs["replace-dirs"]("/foo/fnl/bar", "fnl", "lua")) - return assert.equals("/foo/nfnl/bar", fs["replace-dirs"]("/foo/nfnl/bar", "fnl", "lua")) + assert.equals("foo/bar/baz.fnl", fs["correct-separators"]("foo/bar/baz.fnl")) + return assert.equals("foo/bar/baz.fnl", fs["correct-separators"]("foo\\bar\\baz.fnl")) end end - return it("replaces directories in a path that match a string with another string", _17_) + return it("", _19_) end -return describe("replace-dirs", _16_) +return describe("correct-separators", _18_) diff --git a/script/test.ps1 b/script/test.ps1 index 08640ae..0d079d0 100644 --- a/script/test.ps1 +++ b/script/test.ps1 @@ -1,4 +1,4 @@ $env:XDG_CONFIG_HOME = "$PWD/.test-config" -nvim --headless -c 'edit .nfnl.fnl' -c trust -c qa -nvim --headless -c 'PlenaryBustedDirectory lua/spec' +nvim --headless -c 'edit .nfnl.fnl' -c trust -c qa -i NONE +nvim --headless -c 'PlenaryBustedDirectory lua/spec' -i NONE From a2d37c7453119c75f15ea878110f7a988ddf80cf Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 15:44:55 -0700 Subject: [PATCH 7/8] More progress on figuring out where the test failure is happening. I suspect its upstream --- .test-state/nvim-data/shada/main.shada | Bin 0 -> 1010 bytes .test-state/nvim-data/shada/main.shada.tmp.a | Bin 0 -> 215 bytes .test-state/nvim-data/shada/main.shada.tmp.b | Bin 0 -> 215 bytes .test-state/nvim-data/trust | 2 + fnl/nfnl/core.fnl | 9 ++++- fnl/spec/nfnl/config_spec.fnl | 20 ++++++++-- lua/nfnl/config.lua | 2 +- lua/nfnl/core.lua | 8 +++- lua/spec/nfnl/config_spec.lua | 38 ++++++++++--------- script/test.ps1 | 7 +++- 10 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 .test-state/nvim-data/shada/main.shada create mode 100644 .test-state/nvim-data/shada/main.shada.tmp.a create mode 100644 .test-state/nvim-data/shada/main.shada.tmp.b create mode 100644 .test-state/nvim-data/trust diff --git a/.test-state/nvim-data/shada/main.shada b/.test-state/nvim-data/shada/main.shada new file mode 100644 index 0000000000000000000000000000000000000000..c0ebbef6c270499b2c3a6afe2f61593ced7efc28 GIT binary patch literal 1010 zcmZQPmsZAL?Af|9JvA@2D6u5J=m<+*S!V9?vecsD%>29~Jbq!Gz6xaqdWHsi1}k$D zE8?@0Doawi78hiuoMoA^A~i2LKP59S{RnGmNt&(&`?<8zzkD7|3)7A`I9tVp76Xlm z@pg<1_VleYjBzX|a7ipljPc1&PRxl3NzE;Y0a>PJ5R)91pJ;3xV-S;;mlKneSfmG} z7v>p&jpJ4W87BucE+w@rCZH%kD>b>KI3^FIR1ZW#6dQ7Y?B-T(B&-;$lGhoe(vB=w z!mS0H#ODe!iG2U2<>!OEKozr~VaLqCJn;wv7dSSk<2tZeycEVP)Tayc^teGzKaVeHF?K^b8I33|8hQ zR>Wr~RhFc3EiTARIVtJ%#iXQ`#RL@P pXQd{W6vyPH<>kcafk-_dUYKXV0amQsNLVp51M|cq3|vI32LOn_RV@Gj literal 0 HcmV?d00001 diff --git a/.test-state/nvim-data/shada/main.shada.tmp.b b/.test-state/nvim-data/shada/main.shada.tmp.b new file mode 100644 index 0000000000000000000000000000000000000000..498e980827dbe4a66487791c6625b3a1d3097d35 GIT binary patch literal 215 zcmZQPmsa|h$Fp^1dTL&3QDRAc(GixsvdrA&WvNBQnfZA~c>KaVeHF?K^b8I33|8hQ zR>Wr~RhFc3EiTARIU8WIA~i2LKP59S{RnGmNt&(&JIFk4wWft>N93HXVp3AeVgict pvr>~wievK9@^WJIK%^cJFU&LG04r8*B&?X3fqCK)1}>u20{}e#RILC2 literal 0 HcmV?d00001 diff --git a/.test-state/nvim-data/trust b/.test-state/nvim-data/trust new file mode 100644 index 0000000..66a6c22 --- /dev/null +++ b/.test-state/nvim-data/trust @@ -0,0 +1,2 @@ +9ca097d907d004745e908b54eab6955ef3236c2ab62026a4185271f80f5357fe C:\dev\Projects\nfnl\.nfnl.fnl +e3566b3a06430868d71e9287dfd6c6c520a3da027aabea01951d407ee131dc2f C:\Users\KaySimmons\AppData\Local\Temp\nvim.0\cVoa33\0\.nfnl.fnl diff --git a/fnl/nfnl/core.fnl b/fnl/nfnl/core.fnl index 3c227b5..c4525c8 100644 --- a/fnl/nfnl/core.fnl +++ b/fnl/nfnl/core.fnl @@ -408,6 +408,12 @@ (tset t k nil))) nil) +(fn dbg [x] + "Prints each of the arguments using vim.inspect and returns them. + Great for debugging some confusing code without changing the behavior" + (print (vim.inspect x)) + x) + {: rand : nil? : number? @@ -458,4 +464,5 @@ : constantly : distinct : sort - : clear-table!} + : clear-table! + : dbg} diff --git a/fnl/spec/nfnl/config_spec.fnl b/fnl/spec/nfnl/config_spec.fnl index d5bce9a..e374263 100644 --- a/fnl/spec/nfnl/config_spec.fnl +++ b/fnl/spec/nfnl/config_spec.fnl @@ -1,4 +1,5 @@ (local {: describe : it} (require :plenary.busted)) +(local core (autoload :nfnl.core)) (local assert (require :luassert.assert)) (local config (require :nfnl.config)) (local fs (require :nfnl.fs)) @@ -32,9 +33,24 @@ (assert.is_true (config.config-file-path? ".nfnl.fnl")) (assert.is_false (config.config-file-path? ".fnl.fnl")))))) +(describe + "find" + (fn [] + (it "finds the nearest .nfnl file to the given path" + (fn [] + (assert.equals + (fs.join-path (fs.full-path ".") ".nfnl.fnl") + (fs.join-path ".nfnl.fnl" (config.find "."))))))) + (describe "find-and-load" (fn [] + ; (it "can read found path securely" + ; (fn [] + ; (let [config-file-path (config.find ".") + ; config-source (vim.secure.read (core.dbg (fs.standardize-path config-file-path)))] + ; (assert.equals "{:verbose true}" config-source)))) + (it "loads the repo config file" (fn [] (let [{: cfg : root-dir : config} @@ -45,9 +61,7 @@ (it "returns an empty table if a config file isn't found" (fn [] - (if (= jit.os "Windows") - (assert.are.same {} (config.find-and-load "\\some\\made\\up\\dir")) - (assert.are.same {} (config.find-and-load "/some/made/up/dir"))))))) + (assert.are.same {} (config.find-and-load (fs.correct-separators "/some/made/up/dir"))))))) (fn sorted [xs] (table.sort xs) diff --git a/lua/nfnl/config.lua b/lua/nfnl/config.lua index 1eac1e2..bbb765a 100644 --- a/lua/nfnl/config.lua +++ b/lua/nfnl/config.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/nfnl/config.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\nfnl\config.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("nfnl.module") local autoload = _local_1_["autoload"] local core = autoload("nfnl.core") diff --git a/lua/nfnl/core.lua b/lua/nfnl/core.lua index 1aff3f5..9696790 100644 --- a/lua/nfnl/core.lua +++ b/lua/nfnl/core.lua @@ -1,4 +1,4 @@ --- [nfnl] Compiled from fnl/nfnl/core.fnl by https://github.com/Olical/nfnl, do not edit. +-- [nfnl] Compiled from fnl\nfnl\core.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("nfnl.module") local autoload = _local_1_["autoload"] local fennel = autoload("nfnl.fennel") @@ -443,4 +443,8 @@ local function clear_table_21(t) end return nil end -return {rand = rand, ["nil?"] = nil_3f, ["number?"] = number_3f, ["boolean?"] = boolean_3f, ["string?"] = string_3f, ["table?"] = table_3f, ["function?"] = function_3f, keys = keys, count = count, ["empty?"] = empty_3f, first = first, second = second, last = last, inc = inc, dec = dec, ["even?"] = even_3f, ["odd?"] = odd_3f, vals = vals, ["kv-pairs"] = kv_pairs, ["run!"] = run_21, complement = complement, filter = filter, remove = remove, map = map, ["map-indexed"] = map_indexed, identity = identity, reduce = reduce, some = some, butlast = butlast, rest = rest, concat = concat, mapcat = mapcat, ["pr-str"] = pr_str, str = str, println = println, pr = pr, slurp = slurp, spit = spit, ["merge!"] = merge_21, merge = merge, ["select-keys"] = select_keys, get = get, ["get-in"] = get_in, assoc = assoc, ["assoc-in"] = assoc_in, update = update, ["update-in"] = update_in, constantly = constantly, distinct = distinct, sort = sort, ["clear-table!"] = clear_table_21} +local function dbg(x) + print(vim.inspect(x)) + return x +end +return {rand = rand, ["nil?"] = nil_3f, ["number?"] = number_3f, ["boolean?"] = boolean_3f, ["string?"] = string_3f, ["table?"] = table_3f, ["function?"] = function_3f, keys = keys, count = count, ["empty?"] = empty_3f, first = first, second = second, last = last, inc = inc, dec = dec, ["even?"] = even_3f, ["odd?"] = odd_3f, vals = vals, ["kv-pairs"] = kv_pairs, ["run!"] = run_21, complement = complement, filter = filter, remove = remove, map = map, ["map-indexed"] = map_indexed, identity = identity, reduce = reduce, some = some, butlast = butlast, rest = rest, concat = concat, mapcat = mapcat, ["pr-str"] = pr_str, str = str, println = println, pr = pr, slurp = slurp, spit = spit, ["merge!"] = merge_21, merge = merge, ["select-keys"] = select_keys, get = get, ["get-in"] = get_in, assoc = assoc, ["assoc-in"] = assoc_in, update = update, ["update-in"] = update_in, constantly = constantly, distinct = distinct, sort = sort, ["clear-table!"] = clear_table_21, dbg = dbg} diff --git a/lua/spec/nfnl/config_spec.lua b/lua/spec/nfnl/config_spec.lua index 4859ca3..584d466 100644 --- a/lua/spec/nfnl/config_spec.lua +++ b/lua/spec/nfnl/config_spec.lua @@ -2,6 +2,7 @@ local _local_1_ = require("plenary.busted") local describe = _local_1_["describe"] local it = _local_1_["it"] +local core = autoload("nfnl.core") local assert = require("luassert.assert") local config = require("nfnl.config") local fs = require("nfnl.fs") @@ -36,34 +37,37 @@ end describe("config-file-path?", _6_) local function _8_() local function _9_() - local _let_10_ = config["find-and-load"](".") - local cfg = _let_10_["cfg"] - local root_dir = _let_10_["root-dir"] - local config0 = _let_10_["config"] + return assert.equals(fs["join-path"](fs["full-path"]("."), ".nfnl.fnl"), fs["join-path"](".nfnl.fnl", config.find("."))) + end + return it("finds the nearest .nfnl file to the given path", _9_) +end +describe("find", _8_) +local function _10_() + local function _11_() + local _let_12_ = config["find-and-load"](".") + local cfg = _let_12_["cfg"] + local root_dir = _let_12_["root-dir"] + local config0 = _let_12_["config"] assert.are.same({verbose = true}, config0) assert.equals(vim.fn.getcwd(), root_dir) return assert.equals("function", type(cfg)) end - it("loads the repo config file", _9_) - local function _11_() - if (jit.os == "Windows") then - return assert.are.same({}, config["find-and-load"]("\\some\\made\\up\\dir")) - else - return assert.are.same({}, config["find-and-load"]("/some/made/up/dir")) - end + it("loads the repo config file", _11_) + local function _13_() + return assert.are.same({}, config["find-and-load"](fs["correct-separators"]("/some/made/up/dir"))) end - return it("returns an empty table if a config file isn't found", _11_) + return it("returns an empty table if a config file isn't found", _13_) end -describe("find-and-load", _8_) +describe("find-and-load", _10_) local function sorted(xs) table.sort(xs) return xs end -local function _13_() - local function _14_() +local function _14_() + local function _15_() assert.are.same({"/foo/bar/nfnl", "/foo/baz/my-proj"}, sorted(config["path-dirs"]({runtimepath = "/foo/bar/nfnl,/foo/bar/other-thing", ["rtp-patterns"] = {(fs["path-sep"]() .. "nfnl$")}, ["base-dirs"] = {"/foo/baz/my-proj"}}))) return assert.are.same({"/foo/bar/nfnl", "/foo/baz/my-proj"}, sorted(config["path-dirs"]({runtimepath = "/foo/bar/nfnl,/foo/bar/other-thing", ["rtp-patterns"] = {(fs["path-sep"]() .. "nfnl$")}, ["base-dirs"] = {"/foo/baz/my-proj", "/foo/bar/nfnl"}}))) end - return it("builds path dirs from runtimepath, deduplicates the base-dirs", _14_) + return it("builds path dirs from runtimepath, deduplicates the base-dirs", _15_) end -return describe("path-dirs", _13_) +return describe("path-dirs", _14_) diff --git a/script/test.ps1 b/script/test.ps1 index 0d079d0..1ac1e21 100644 --- a/script/test.ps1 +++ b/script/test.ps1 @@ -1,4 +1,7 @@ $env:XDG_CONFIG_HOME = "$PWD/.test-config" +$env:XDG_STATE_HOME = "$PWD/.test-state" -nvim --headless -c 'edit .nfnl.fnl' -c trust -c qa -i NONE -nvim --headless -c 'PlenaryBustedDirectory lua/spec' -i NONE +rm -for -rec $env:XDG_STATE_HOME -erroraction 'silentlycontinue' + +nvim --headless -c 'edit .nfnl.fnl' -c trust -c qa +nvim --headless -c 'PlenaryBustedDirectory lua\\spec' From d3a247f8d600b592df3b485f4c1673e1d616ff88 Mon Sep 17 00:00:00 2001 From: Kaylee Simmons Date: Fri, 21 Jun 2024 15:46:11 -0700 Subject: [PATCH 8/8] Add test-state to git ignore --- .gitignore | 1 + .test-state/nvim-data/shada/main.shada | Bin 1010 -> 0 bytes .test-state/nvim-data/shada/main.shada.tmp.a | Bin 215 -> 0 bytes .test-state/nvim-data/shada/main.shada.tmp.b | Bin 215 -> 0 bytes .test-state/nvim-data/trust | 2 -- 5 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .test-state/nvim-data/shada/main.shada delete mode 100644 .test-state/nvim-data/shada/main.shada.tmp.a delete mode 100644 .test-state/nvim-data/shada/main.shada.tmp.b delete mode 100644 .test-state/nvim-data/trust diff --git a/.gitignore b/.gitignore index ce2296b..2c83a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.clj-kondo/ /.test-config/ +/.test-state/ diff --git a/.test-state/nvim-data/shada/main.shada b/.test-state/nvim-data/shada/main.shada deleted file mode 100644 index c0ebbef6c270499b2c3a6afe2f61593ced7efc28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1010 zcmZQPmsZAL?Af|9JvA@2D6u5J=m<+*S!V9?vecsD%>29~Jbq!Gz6xaqdWHsi1}k$D zE8?@0Doawi78hiuoMoA^A~i2LKP59S{RnGmNt&(&`?<8zzkD7|3)7A`I9tVp76Xlm z@pg<1_VleYjBzX|a7ipljPc1&PRxl3NzE;Y0a>PJ5R)91pJ;3xV-S;;mlKneSfmG} z7v>p&jpJ4W87BucE+w@rCZH%kD>b>KI3^FIR1ZW#6dQ7Y?B-T(B&-;$lGhoe(vB=w z!mS0H#ODe!iG2U2<>!OEKozr~VaLqCJn;wv7dSSk<2tZeycEVP)Tayc^teGzKaVeHF?K^b8I33|8hQ zR>Wr~RhFc3EiTARIVtJ%#iXQ`#RL@P pXQd{W6vyPH<>kcafk-_dUYKXV0amQsNLVp51M|cq3|vI32LOn_RV@Gj diff --git a/.test-state/nvim-data/shada/main.shada.tmp.b b/.test-state/nvim-data/shada/main.shada.tmp.b deleted file mode 100644 index 498e980827dbe4a66487791c6625b3a1d3097d35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 215 zcmZQPmsa|h$Fp^1dTL&3QDRAc(GixsvdrA&WvNBQnfZA~c>KaVeHF?K^b8I33|8hQ zR>Wr~RhFc3EiTARIU8WIA~i2LKP59S{RnGmNt&(&JIFk4wWft>N93HXVp3AeVgict pvr>~wievK9@^WJIK%^cJFU&LG04r8*B&?X3fqCK)1}>u20{}e#RILC2 diff --git a/.test-state/nvim-data/trust b/.test-state/nvim-data/trust deleted file mode 100644 index 66a6c22..0000000 --- a/.test-state/nvim-data/trust +++ /dev/null @@ -1,2 +0,0 @@ -9ca097d907d004745e908b54eab6955ef3236c2ab62026a4185271f80f5357fe C:\dev\Projects\nfnl\.nfnl.fnl -e3566b3a06430868d71e9287dfd6c6c520a3da027aabea01951d407ee131dc2f C:\Users\KaySimmons\AppData\Local\Temp\nvim.0\cVoa33\0\.nfnl.fnl