diff options
| author | William Boman <william@redwill.se> | 2022-05-11 16:10:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-11 16:10:57 +0200 |
| commit | 5e3385d90668c792919c7e2791620a6c0d569538 (patch) | |
| tree | 4b0158d3ac7765db47411d57ec754a96f8eaf1f9 /tests/core/path_spec.lua | |
| parent | chore!: remove zeta_note (diff) | |
| download | mason-5e3385d90668c792919c7e2791620a6c0d569538.tar mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.gz mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.bz2 mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.lz mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.xz mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.zst mason-5e3385d90668c792919c7e2791620a6c0d569538.zip | |
chore: further decouple module structure (#685)
Diffstat (limited to 'tests/core/path_spec.lua')
| -rw-r--r-- | tests/core/path_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/core/path_spec.lua b/tests/core/path_spec.lua new file mode 100644 index 00000000..e4e964d9 --- /dev/null +++ b/tests/core/path_spec.lua @@ -0,0 +1,23 @@ +local path = require "nvim-lsp-installer.core.path" + +describe("path", function() + it("concatenates paths", function() + assert.equal("foo/bar/baz/~", path.concat { "foo", "bar", "baz", "~" }) + end) + + it("concatenates paths on Windows", function() + local old_os = jit.os + jit.os = "windows" + package.loaded["nvim-lsp-installer.core.path"] = nil + local path = require "nvim-lsp-installer.core.path" + assert.equal([[foo\bar\baz\~]], path.concat { "foo", "bar", "baz", "~" }) + jit.os = old_os + end) + + it("identifies subdirectories", function() + assert.is_true(path.is_subdirectory("/foo/bar", "/foo/bar/baz")) + assert.is_true(path.is_subdirectory("/foo/bar", "/foo/bar")) + assert.is_false(path.is_subdirectory("/foo/bar", "/foo/bas/baz")) + assert.is_false(path.is_subdirectory("/foo/bar", "/foo/bars/baz")) + end) +end) |
