Reorder some tests and add modelines everywhere

This commit is contained in:
Israel Chauca Fuentes
2017-02-11 19:36:15 -05:00
parent 0f6581c6f3
commit 6f038350de
8 changed files with 126 additions and 82 deletions

View File

@@ -413,3 +413,4 @@ function! s:keys4cr(info, opts) "{{{1
echom 79
return ''
endfunction
" vim: sw=2 et

View File

@@ -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

View File

@@ -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\<BS>", "")
call DMTest_pairs('()', "a)x", "()x")
"call DMTest_pairs('', "((\<C-G>gx", "(())x")
call DMTest_pairs('', "i(x\<Esc>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('', "(\<S-Tab>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()\<BS>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(\<Space>x", "( x )")
call DMTest_pairs('( )', "2|a\<BS>x", "(x)")
call DMTest_pairs('', "iabc x", "abc x")
let g:delimitMate_autoclose = 0
call DMTest_pairs('', "i()\<Space>\<BS>x", "(x)")
let g:delimitMate_autoclose = 1
" Handle backspace gracefully.
set backspace=
call DMTest_pairs('', "i(\<Esc>a\<BS>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(\<BS>", "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\<C-G>u(c)b\<C-O>u", "a")
"
" Play nice with undo.
call DMTest_pairs('', "ia\<C-G>u(c)b\<Esc>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

View File

@@ -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\<Esc>u", "")
call DMTest_quotes('', "i''x", "''x")
call DMTest_quotes("''", "a\<BS>x", "x")
"call DMTest_quotes('', "'\<C-G>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('', "'\<S-Tab>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''\<BS>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' \<BS>x", "'x'")
call DMTest_quotes('abc\', "A'' x", "abc\\'' x '")
let g:delimitMate_autoclose = 0
call DMTest_quotes('', "i'' \<BS>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'\<Esc>a\<BS>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'\<CR>\<BS>", "''")
" Double quote starts a comment in viml
set ft=vim
call DMTest_single('', 'i"', '"')
set ft=
call vimtest#Quit()
" vim: sw=2 et

View File

@@ -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;\<Left>{(\<CR>x", ['{(', 'x', ')};'])
" End: quit vim.
call vimtest#Quit()
" vim: sw=2 et

View File

@@ -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(\<CR>test)x",
call DMTest_single('',
\ "i(\<CR>test)x",
\ ['(', 'test', ')x'])
" Remove CR expansion on BS
call DMTest_single('', "i(\<CR>\<BS>x",
call DMTest_single('',
\ "i(\<CR>\<BS>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 {\<CR>x",
\['abc {',
call DMTest_single('',
\ "iabc {\<CR>x",
\ ['abc {',
\ ' x',
\ '}'])
:bp
" expand_cr != 2
call DMTest_single('abc(def)', "i\<Esc>$i\<CR>x",
call DMTest_single('abc(def)',
\ "i\<Esc>$i\<CR>x",
\ ['abc(def',
\ ' x)'])
" expand_cr == 2
let delimitMate_expand_cr = 2
call DMTest_single('abc(def)', "$i\<CR>x", ['abc(def', ' x', ' )'])
call DMTest_single('abc(def)',
\ "$i\<CR>x",
\ ['abc(def',
\ ' x',
\ ' )'])
" Play nice with smartindent
set all&
@@ -102,3 +111,4 @@ let delimitMate_expand_inside_quotes = 1
call DMTest_quotes('', "i'\<CR>x", ["'", "x", "'"])
call vimtest#Quit()
" vim: sw=2 et

View File

@@ -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(\<Space>x", "( x )")
call DMTest_pairs('( )', "la\<BS>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' \<BS>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()\<Space>\<BS>x", "(x)")
call DMTest_quotes('', "i' x", "' x '")
call DMTest_quotes('', "i'' \<BS>x", "'x'")
call vimtest#Quit()
" vim: sw=2 et

View File

@@ -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'), '<Plug>delimitMate(', 'Mappings defined for the first buffer without filetype set.')
call vimtest#Quit()