-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2afa30
commit e305f1a
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
*.md | ||
.tests | ||
doc/tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local M = {} | ||
|
||
function M.root(root) | ||
local f = debug.getinfo(1, "S").source:sub(2) | ||
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "") | ||
end | ||
|
||
---@param plugin string | ||
function M.load(plugin) | ||
local name = plugin:match(".*/(.*)") | ||
local package_root = M.root(".tests/site/pack/deps/start/") | ||
if not vim.loop.fs_stat(package_root .. name) then | ||
print("Installing " .. plugin) | ||
vim.fn.mkdir(package_root, "p") | ||
vim.fn.system({ | ||
"git", | ||
"clone", | ||
"--depth=1", | ||
"https://github.com/" .. plugin .. ".git", | ||
package_root .. "/" .. name, | ||
}) | ||
end | ||
end | ||
|
||
function M.setup() | ||
vim.cmd([[set runtimepath=$VIMRUNTIME]]) | ||
vim.opt.runtimepath:append(M.root()) | ||
vim.opt.packpath = { M.root(".tests/site") } | ||
|
||
M.load("nvim-lua/plenary.nvim") | ||
end | ||
|
||
M.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
local util = require("img-clip.util") | ||
|
||
describe("util", function() | ||
it("can get the directory path from the file path", function() | ||
local dir_path = util.get_dir_path_from_filepath("/home/user/project/image.png") | ||
assert.same("/home/user/project/", dir_path) | ||
end) | ||
end) |