|
| 1 | +---@diagnostic disable: undefined-global, lowercase-global, undefined-field |
| 2 | + |
| 3 | +local eq = assert.are.same |
| 4 | + |
| 5 | +describe("createautocmd", function() |
| 6 | + -- Setup environment for tests |
| 7 | + before_each(function() |
| 8 | + local opts = { |
| 9 | + autouse = true, |
| 10 | + directories = { vim.fn.stdpath("config") .. "/skeletons" }, |
| 11 | + patterns = function(dir) return vim.fn.readdir(dir) end, |
| 12 | + wildcards = { |
| 13 | + expand = true, |
| 14 | + lookup = { |
| 15 | + -- File |
| 16 | + ["filename"] = function() return vim.fn.expand("%:t:r") end, |
| 17 | + ["fileabspath"] = function() return vim.fn.expand("%:p") end, |
| 18 | + ["filerelpath"] = function() return vim.fn.expand("%:p:~") end, |
| 19 | + ["fileext"] = function() return vim.fn.expand("%:e") end, |
| 20 | + ["filetype"] = function() return vim.bo.filetype end, |
| 21 | + |
| 22 | + -- Date and time |
| 23 | + ["date"] = function() return os.date("%Y%m%d", os.time()) end, |
| 24 | + ["year"] = function() return os.date("%Y", os.time()) end, |
| 25 | + ["month"] = function() return os.date("%m", os.time()) end, |
| 26 | + ["day"] = function() return os.date("%d", os.time()) end, |
| 27 | + ["time"] = function() return os.date("%T", os.time()) end, |
| 28 | + |
| 29 | + -- System |
| 30 | + ["host"] = "gh", |
| 31 | + ["user"] = "gh-ci", |
| 32 | + |
| 33 | + -- Github |
| 34 | + ["gh-email"] = "n/a", |
| 35 | + ["gh-user"] = "n/a", |
| 36 | + }, |
| 37 | + }, |
| 38 | + advanced = { |
| 39 | + ignored = {}, |
| 40 | + ignore_os_files = true, |
| 41 | + }, |
| 42 | + } |
| 43 | + |
| 44 | + autocmds = require("esqueleto.autocmd").createautocmd(opts) |
| 45 | + end) |
| 46 | + |
| 47 | + it("should createa autocmds", function() |
| 48 | + -- Expected behaviour |
| 49 | + local group_name = "esqueleto" |
| 50 | + local existing_autocmds = vim.api.nvim_get_autocmds({ |
| 51 | + group = group_name, |
| 52 | + }) |
| 53 | + vim.print(existing_autocmds) |
| 54 | + |
| 55 | + -- Observed behaviour |
| 56 | + |
| 57 | + eq(true == true) -- Check if behaviours are equal |
| 58 | + end) |
| 59 | +end) |
0 commit comments