>>>> H
END
call assert_equal(expected, getline(1, '$'))
- close!
+ bw!
endfunc
" Test for the 'b' flag in 'comments'
H
END
call assert_equal(expected, getline(1, '$'))
- close!
+ bw!
endfunc
" Test for the 'f' flag in 'comments' (only the first line has a comment
setlocal comments=:-
exe "normal i- B\nD\<C-C>ggoC\<C-C>ggOA\<C-C>"
call assert_equal(['- A', '- B', '- C', '- D'], getline(1, '$'))
- close!
+ bw!
endfunc
" Test for the 's', 'm' and 'e' flags in 'comments'
setlocal autoindent noexpandtab
call feedkeys("a\t/*\tone\ntwo\n/", 'xt')
call assert_equal(["\t/*\tone", "\t *\ttwo", "\t */"], getline(1, '$'))
- close!
+ bw!
endfunc
" Test for the 'r' flag in 'comments' (right align comment)
G
END
call assert_equal(expected, getline(1, '$'))
- close!
+ bw!
endfunc
" Test for the 'O' flag in 'comments'
* D
END
call assert_equal(expected, getline(1, '$'))
- close!
+ bw!
endfunc
" Test for using a multibyte character as a comment leader
call assert_equal(expected, getline(1, '$'))
set tw& fo& comments&
- close!
+ bw!
endfunc
" Test for a space character in 'comments' setting
> H
END
call assert_equal(expected, getline(1, '$'))
- close!
+ bw!
endfunc
" Test for formatting lines with and without comments
call setline(1, ['one', '/* two */', 'three'])
normal gggqG
call assert_equal(['one', '/* two */', 'three'], getline(1, '$'))
- close!
+ bw!
endfunc
" Test for using 'a' in 'formatoptions' with comments
call assert_equal(['one'], getline(1, '$'))
set backspace&
- close!
+ bw!
endfunc
" Test for joining lines with comments ('j' flag in 'formatoptions')
call setline(1, ['i++; > ) > ) comment1', ' > ) comment2'])
normal J
call assert_equal('i++; > ) > ) comment1 comment2', getline(1))
- close!
+ bw!
endfunc
" Test for formatting lines where only the first line has a comment.
call setline(1, ['- one', '- two'])
normal gggqG
call assert_equal(['- one', '- two'], getline(1, '$'))
- close!
+ bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab