Skip to content

Commit

Permalink
Add unit tests for options
Browse files Browse the repository at this point in the history
  • Loading branch information
dcampos committed Jan 11, 2022
1 parent d983d2d commit e50df39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/snippets/custom.snippets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
snippet trigger "description" A
snippet trigger "description"
This is indented with two spaces.
This is indented with four spaces.
This is indented with eight spaces.
11 changes: 10 additions & 1 deletion test/unit/reader_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Snippet reader', function()
trigger = {
kind = 'snipmate',
prefix = 'trigger',
option = { auto_trigger = true },
option = {},
description = 'description',
body = {
'This is indented with two spaces.',
Expand All @@ -62,6 +62,15 @@ describe('Snippet reader', function()
assert.is_same(snips, snippy.snippets.custom)
end)

it('can read snippets with otions', function()
snippy.setup({ snippet_dirs = './test/snippets/' })
vim.cmd('set filetype=java')
assert.is_truthy(require('snippy.shared').config.snippet_dirs)
assert.is_not.same({}, require('snippy.reader.snipmate').list_available_scopes())
assert.is_same({ beginning = true }, snippy.snippets.java.cls.option)
assert.is_same({ auto_trigger = true }, snippy.snippets.java.psvm.option)
end)

it('can read vim-snippets snippets', function()
local snippet_dirs = os.getenv('VIM_SNIPPETS_PATH') or './vim-snippets/snippets/'
snippy.setup({
Expand Down

0 comments on commit e50df39

Please sign in to comment.