-
Notifications
You must be signed in to change notification settings - Fork 1
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
2f6490e
commit 10665f9
Showing
5 changed files
with
81 additions
and
52 deletions.
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
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,13 @@ | ||
local plenary_dir = os.getenv("PLENARY_DIR") or "/tmp/plenary.nvim" | ||
local is_not_a_directory = vim.fn.isdirectory(plenary_dir) == 0 | ||
if is_not_a_directory then | ||
vim.fn.system({ "git", "clone", "https://github.com/nvim-lua/plenary.nvim", plenary_dir }) | ||
end | ||
|
||
vim.opt.rtp:append(".") | ||
vim.opt.rtp:append(plenary_dir) | ||
|
||
vim.cmd("runtime plugin/plenary.vim") | ||
require("plenary.busted") | ||
|
||
print("Running tests...") |
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,45 @@ | ||
local utils = require("telescope._extensions.resession.utils") | ||
|
||
describe("apply_substitutions", function() | ||
it("should apply substitutions to a session string", function() | ||
local session = "C__Users_user_AppData_Local_nvim" | ||
local substitutions = utils.internal_substitutions | ||
local result = utils.apply_substitutions(session, substitutions, true) | ||
assert.are.same("C:/Users/user/AppData/Local/nvim", result) | ||
end) | ||
|
||
it("should apply substitutions in reverse to a session string", function() | ||
local session = "C:/Users/user/AppData/Local/nvim" | ||
local substitutions = utils.internal_substitutions | ||
local result = utils.apply_substitutions(session, substitutions) | ||
assert.are.same("C__Users_user_AppData_Local_nvim", result) | ||
end) | ||
|
||
it("should apply substitutions to a session string with user substitutions", function() | ||
local session = "C:/Users/user/AppData/Local/nvim" | ||
local substitutions = { | ||
{ find = "C:/", replace = "D:/" }, | ||
{ find = "nvim", replace = "neovim" }, | ||
} | ||
local result = utils.apply_substitutions(session, substitutions) | ||
assert.are.same("D:/Users/user/AppData/Local/neovim", result) | ||
end) | ||
end) | ||
|
||
describe("encode_session", function() | ||
it("should encode a session string", function() | ||
local session = "D:/Users/user/AppData/Local/neovim" | ||
local opts = { path_substitutions = { { find = "C:/", replace = "D:/" } } } | ||
local result = utils.encode_session(session, opts) | ||
assert.are.same("C__Users_user_AppData_Local_neovim", result) | ||
end) | ||
end) | ||
|
||
describe("decode_sessions", function() | ||
it("should decode a list of session strings", function() | ||
local sessions = { "C__Users_user_AppData_Local_neovim" } | ||
local opts = { path_substitutions = { { find = "C:/", replace = "D:/" } } } | ||
local result = utils.decode_sessions(sessions, opts) | ||
assert.are.same({ "D:/Users/user/AppData/Local/neovim" }, result) | ||
end) | ||
end) |