diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index 68448fe..ed7b387 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -413,3 +413,4 @@ function! s:keys4cr(info, opts) "{{{1 echom 79 return '' endfunction +" vim: sw=2 et diff --git a/test/_setup.vim b/test/_setup.vim index 6ac9f7b..2993be8 100644 --- a/test/_setup.vim +++ b/test/_setup.vim @@ -117,3 +117,4 @@ function! DMTest_quotes(setup, typed, expected, ...) let sub = 'quote' return s:do_set(pat, sub, quotes, a:setup, a:typed, a:expected, skip_expr, todo_expr) endfunction +" vim: sw=2 et diff --git a/test/autoclose_matchpairs.vim b/test/autoclose_matchpairs.vim index 9b5168a..5426d26 100644 --- a/test/autoclose_matchpairs.vim +++ b/test/autoclose_matchpairs.vim @@ -1,79 +1,90 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) +" call DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) " - Runs a single test. " - Add 1 to vimtap#Plan(). " -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every pair. " - Add 7 to vimtap#Plan(). " -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every quote. " - Add 5 to vimtap#Plan(). call vimtest#StartTap() -call vimtap#Plan(210) + +call vimtap#Plan(189) + let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!,,::' let g:delimitMate_autoclose = 1 call DMTest_pairs('', "i(", "()") + call DMTest_pairs('()', "a\", "") + call DMTest_pairs('()', "a)x", "()x") + "call DMTest_pairs('', "((\gx", "(())x") call DMTest_pairs('', "i(x\u", "") + call DMTest_pairs('', "i@(x", "@(x)") + call DMTest_pairs('@#', "a(x", "@(x)#") + call DMTest_pairs('\', "a(x", '\(x') + call DMTest_pairs('(\)', "la)x", '(\)x)') + "call DMTest_pairs('', "(\x", "()x") let g:delimitMate_autoclose = 0 call DMTest_pairs('', "i(x", "(x") + call DMTest_pairs('', "i()x", "(x)") + call DMTest_pairs('', "i())x", "()x") + call DMTest_pairs('', "i()\x", "x") + call DMTest_pairs('', "i@()x", "@(x)") + call DMTest_pairs('@#', "a()x", "@(x)#") -let g:delimitMate_expand_space = 1 -let g:delimitMate_autoclose = 1 -call DMTest_pairs('', "i(\x", "( x )") -call DMTest_pairs('( )', "2|a\x", "(x)") -call DMTest_pairs('', "iabc x", "abc x") -let g:delimitMate_autoclose = 0 -call DMTest_pairs('', "i()\\x", "(x)") + let g:delimitMate_autoclose = 1 " Handle backspace gracefully. set backspace= call DMTest_pairs('', "i(\a\x", "(x)") + set backspace=2 " closing parens removes characters. #133 call DMTest_pairs('(a)', "a)", "()a)") -" Add semicolon next to the closing paren. Issue #77. -"new -"let b:delimitMate_eol_marker = ';' -"call DMTest_pairs('', "abc(x", "abc(x);") -"" BS should behave accordingly. -"call DMTest_pairs('', "abc(\", "abc;") -"unlet b:delimitMate_eol_marker " Expand iabbreviations iabb def ghi -" TODO not sure how to make this test actually test if the feature works. -call DMTest_pairs('', "idef(", "ghi()") ", '', 1) +call DMTest_pairs('', "idef(", "ghi()") iunabb def call DMTest_pairs("abc а", "$i(", "abc (а") + call DMTest_pairs("abc ñ", "$i(", "abc (ñ") + call DMTest_pairs("abc $", "$i(", "abc ($") + call DMTest_pairs("abc £", "$i(", "abc (£") + call DMTest_pairs("abc d", "$i(", "abc (d") + call DMTest_pairs("abc .", "$i(", "abc ().") + call DMTest_pairs("abc ", "$i(", "abc () ") + call DMTest_pairs("abc (", "$i(", "abc ((") -"" Play nice with undo. -"call DMTest_pairs('', "a\u(c)b\u", "a") -" +" Play nice with undo. +call DMTest_pairs('', "ia\u(c)b\u", "a") + let g:delimitMate_autoclose = 1 let g:delimitMate_balance_pairs = 1 -call DMTest_pairs('ab cd)', "2|a(x", 'ab(x cd)') +call DMTest_pairs('ab cd)', "la(x", 'ab(x cd)') + call vimtest#Quit() +" vim: sw=2 et diff --git a/test/autoclose_quotes.vim b/test/autoclose_quotes.vim index 60fd66d..2b37ad7 100644 --- a/test/autoclose_quotes.vim +++ b/test/autoclose_quotes.vim @@ -1,83 +1,105 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) +" call DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) " - Runs a single test. " - Add 1 to vimtap#Plan(). " -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every pair. " - Add 7 to vimtap#Plan(). " -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every quote. " - Add 5 to vimtap#Plan(). call vimtest#StartTap() -call vimtap#Plan(170) + +call vimtap#Plan(142) + let g:delimitMate_autoclose = 1 call DMTest_quotes('', "i'x", "'x'") + call DMTest_quotes('', "i'x\u", "") + call DMTest_quotes('', "i''x", "''x") + call DMTest_quotes("''", "a\x", "x") + "call DMTest_quotes('', "'\gx", "''x") " This will fail for double quote. call DMTest_quotes('', "i'\"x", "'\"x\"'", 'a:typed =~ "i\"\"x"') + call DMTest_quotes('', "i@'x", "@'x'") + call DMTest_quotes('@#', "a'x", "@'x'#") + "call DMTest_quotes('', "'\x", "''x") call DMTest_quotes('abc', "A'", "abc'") + call DMTest_quotes('abc\', "A'x", "abc\\'x") + call DMTest_quotes('', "au'Привет'", "u'Привет'") + call DMTest_quotes('', "au'string'", "u'string'") + let g:delimitMate_autoclose = 0 call DMTest_quotes('', "a'x", "'x") + call DMTest_quotes('', "a''x", "'x'") + call DMTest_quotes('', "a'''x", "''x") + call DMTest_quotes('', "a''\x", "x") + call DMTest_quotes('', "a@''x", "@'x'") + call DMTest_quotes('@#', "a''x", "@'x'#") -let g:delimitMate_autoclose = 1 -let g:delimitMate_expand_space = 1 -call DMTest_quotes('', "i' x", "' x'") -let g:delimitMate_expand_inside_quotes = 1 -call DMTest_quotes('', "i' x", "' x '") -call DMTest_quotes('', "i' \x", "'x'") -call DMTest_quotes('abc\', "A'' x", "abc\\'' x '") -let g:delimitMate_autoclose = 0 -call DMTest_quotes('', "i'' \x", "'x'") -unlet g:delimitMate_expand_space -unlet g:delimitMate_expand_inside_quotes + let g:delimitMate_autoclose = 1 " Handle backspace gracefully. set backspace= call DMTest_quotes('', "a'\a\x", "'x'") + set backspace=2 "set cpo=ces$ "call DMTest_quotes('', "'x", "'x'") " Make sure smart quote works beyond first column. call DMTest_quotes(' ', "a'x", " 'x'") + " smart quote, check fo char on the right. call DMTest_quotes('a b', "la'", "a 'b") + " Make sure we jump over a quote on the right. #89. call DMTest_quotes('', "a('test'x", "('test'x)") + " Duplicate whole line when inserting quote at bol #105 call DMTest_quotes('}', "i'", "''}") + call DMTest_quotes("'abc ", "A'", "'abc '") + call DMTest_quotes("''abc ", "A'", "''abc ''") + " Nesting quotes: let g:delimitMate_nesting_quotes = delimitMate#option('quotes') call DMTest_quotes("''", "A'x", "'''x'''") + call DMTest_quotes("'''", "A'x", "''''x''''") + call DMTest_quotes('', "i''x", "''x") + call DMTest_quotes('', "i'x", "'x'") + unlet g:delimitMate_nesting_quotes " expand iabbreviations iabb def ghi -call DMTest_quotes('', "idef'", "ghi'", 'a:typed =~ "^idef[''`«|]"') +call DMTest_single('', 'idef"', 'ghi"') + iunabb def ""call DMTest_quotes('', "i'\\", "''") " Double quote starts a comment in viml set ft=vim call DMTest_single('', 'i"', '"') + set ft= call vimtest#Quit() +" vim: sw=2 et diff --git a/test/eol_marker.vim b/test/eol_marker.vim index 8be1049..7136160 100644 --- a/test/eol_marker.vim +++ b/test/eol_marker.vim @@ -1,12 +1,12 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) +" call DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) " - Runs a single test. " - Add 1 to vimtap#Plan(). " -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every pair. " - Add 7 to vimtap#Plan(). " -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every quote. " - Add 5 to vimtap#Plan(). @@ -40,3 +40,4 @@ call DMTest_single('', "i;\{(\x", ['{(', 'x', ')};']) " End: quit vim. call vimtest#Quit() +" vim: sw=2 et diff --git a/test/expand_cr.vim b/test/expand_cr.vim index 6f8114b..1e3b0bd 100644 --- a/test/expand_cr.vim +++ b/test/expand_cr.vim @@ -1,12 +1,12 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) +" call DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) " - Runs a single test. " - Add 1 to vimtap#Plan(). " -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every pair. " - Add 7 to vimtap#Plan(). " -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every quote. " - Add 5 to vimtap#Plan(). @@ -25,11 +25,13 @@ call DMTest_single('$(document).ready(function() {})', " Issue #95 new let b:delimitMate_jump_expansion = 1 -call DMTest_single('', "i(\test)x", +call DMTest_single('', + \ "i(\test)x", \ ['(', 'test', ')x']) " Remove CR expansion on BS -call DMTest_single('', "i(\\x", +call DMTest_single('', + \ "i(\\x", \ ['(x)']) " Consider indentation with BS inside an empty CR expansion. @@ -72,19 +74,26 @@ set foldmethod=marker set foldmarker={,} set foldlevel=0 set backspace=2 -call DMTest_single('', "iabc {\x", - \['abc {', - \ ' x', - \ '}']) +call DMTest_single('', + \ "iabc {\x", + \ ['abc {', + \ ' x', + \ '}']) :bp + " expand_cr != 2 -call DMTest_single('abc(def)', "i\$i\x", +call DMTest_single('abc(def)', + \ "i\$i\x", \ ['abc(def', \ ' x)']) " expand_cr == 2 let delimitMate_expand_cr = 2 -call DMTest_single('abc(def)', "$i\x", ['abc(def', ' x', ' )']) +call DMTest_single('abc(def)', + \ "$i\x", + \ ['abc(def', + \ ' x', + \ ' )']) " Play nice with smartindent set all& @@ -102,3 +111,4 @@ let delimitMate_expand_inside_quotes = 1 call DMTest_quotes('', "i'\x", ["'", "x", "'"]) call vimtest#Quit() +" vim: sw=2 et diff --git a/test/expand_space.vim b/test/expand_space.vim index a29c902..1ef1f00 100644 --- a/test/expand_space.vim +++ b/test/expand_space.vim @@ -1,26 +1,46 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) +" call DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) " - Runs a single test. " - Add 1 to vimtap#Plan(). " -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every pair. " - Add 7 to vimtap#Plan(). " -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) +" call DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) " - Runs one test for every quote. " - Add 5 to vimtap#Plan(). call vimtest#StartTap() -call vimtap#Plan(12) + +call vimtap#Plan(60) + let g:delimitMate_expand_space = 1 +let g:delimitMate_autoclose = 1 +call DMTest_pairs('', "i(\x", "( x )") + +call DMTest_pairs('( )', "la\x", "(x)") + +call DMTest_pairs('', "iabc x", "abc x") + +call DMTest_quotes('', "i' x", "' x'") + +let g:delimitMate_expand_inside_quotes = 1 +call DMTest_quotes('', "i' x", "' x '") + +call DMTest_quotes('', "i' \x", "'x'") + +call DMTest_quotes('abc\', "A'' x", "abc\\'' x '") + " Issue #95 let b:delimitMate_jump_expansion = 1 call DMTest_pairs('', "i( test)x", '( test )x') -let delimitMate_expand_inside_quotes = 1 +let g:delimitMate_autoclose = 0 +call DMTest_pairs('', "i()\\x", "(x)") -call DMTest_quotes('', "i' x", "' x '") +call DMTest_quotes('', "i'' \x", "'x'") call vimtest#Quit() +" vim: sw=2 et diff --git a/test/first_buffer_no_ft.vim b/test/first_buffer_no_ft.vim deleted file mode 100644 index c646692..0000000 --- a/test/first_buffer_no_ft.vim +++ /dev/null @@ -1,22 +0,0 @@ -" function! DMTest_single(setup, typed, expected[, skip_expr[, todo_expr]]) -" - Runs a single test. -" - Add 1 to vimtap#Plan(). -" -" function! DMTest_pairs(setup, typed, expected, [skip_expr[, todo_expr]]) -" - Runs one test for every pair. -" - Add 7 to vimtap#Plan(). -" -" function! DMTest_quotes(setup, typed, expected, [skip_expr[, todo_expr]]) -" - Runs one test for every quote. -" - Add 5 to vimtap#Plan(). - -call vimtest#StartTap() -call vimtap#Plan(1) - -let g:delimitMate_expand_cr = 1 -let g:delimitMate_eol_marker = ';' -DelimitMateReload -call vimtap#Like(maparg('(', 'i'), 'delimitMate(', 'Mappings defined for the first buffer without filetype set.') -call vimtest#Quit() - -