diff --git a/Makefile b/Makefile index 19494a6..284268c 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,5 @@ test: nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}" + +test-file: + nvim --headless --noplugin -u tests/minimal.vim -c "lua require(\"plenary.busted\").run(\"$(FILE)\")" diff --git a/lua/nvim-autopairs/conds.lua b/lua/nvim-autopairs/conds.lua index 8b08d2f..9e98987 100644 --- a/lua/nvim-autopairs/conds.lua +++ b/lua/nvim-autopairs/conds.lua @@ -165,6 +165,14 @@ cond.is_bracket_line = function() end end + +cond.inside_quote = function() + return function(opts) + log.debug('inside_quote') + return utils.is_in_quotes(opts.text, opts.col - 1) + end +end + cond.not_inside_quote = function() return function(opts) log.debug('not_inside_quote') diff --git a/tests/test_utils.lua b/tests/test_utils.lua index 8ee3b41..82ab3bf 100644 --- a/tests/test_utils.lua +++ b/tests/test_utils.lua @@ -57,7 +57,6 @@ local compare_text = function(linenr, text_after, name, cursor_add, end_cursor) linenr + #text_after - 1, true ) - log.debug(new_text) for i = 1, #text_after, 1 do local t = string.gsub(text_after[i], '%|', '') if @@ -74,7 +73,6 @@ local compare_text = function(linenr, text_after, name, cursor_add, end_cursor) eq(row, linenr + i - 2, '\n\n cursor row error: ' .. name .. '\n') eq(col + 1, end_cursor, '\n\n end cursor column error : ' .. name .. '\n') else - log.debug(p_after) eq(row, linenr + i - 2, '\n\n cursor row error: ' .. name .. '\n') p_after = p_after + cursor_add eq(col, math.max(p_after - 2,0), '\n\n cursor column error : ' .. name .. '\n')