aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorKunMing Xie <qqzz014@gmail.com>2018-01-25 18:26:47 +0800
committerJustin M. Keyes <justinkz@gmail.com>2018-01-25 11:26:47 +0100
commit8b1f7d8774b235ae4f0dc0fa64d58e3cad9f8283 (patch)
treecbd6682b648eb1b9617654eb1d41a61a957e6abd /src/nvim/testdir
parenta3daa8cb136c83c2fc0e5c9283cde1f7a8ce246c (diff)
downloadrneovim-8b1f7d8774b235ae4f0dc0fa64d58e3cad9f8283.tar.gz
rneovim-8b1f7d8774b235ae4f0dc0fa64d58e3cad9f8283.tar.bz2
rneovim-8b1f7d8774b235ae4f0dc0fa64d58e3cad9f8283.zip
vim-patch:8.0.0431 (#7908)
vim-patch:8.0.0431: 'cinoptions' cannot set indent for extern block Problem: 'cinoptions' cannot set indent for extern block. Solution: Add the "E" flag in 'cinoptions'. (Hirohito Higashi) https://github.com/vim/vim/commit/7720ba8599162fbbb8f7fc034f674a2ccd3ca7f1
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_cindent.vim60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim
index 5685c2be66..444c4c4109 100644
--- a/src/nvim/testdir/test_cindent.vim
+++ b/src/nvim/testdir/test_cindent.vim
@@ -14,3 +14,63 @@ func Test_cino_hash()
call assert_equal(["#include <iostream>", "#include"], getline(1,2))
bwipe!
endfunc
+
+func Test_cino_extern_c()
+ " Test for cino-E
+
+ let without_ind = [
+ \ '#ifdef __cplusplus',
+ \ 'extern "C" {',
+ \ '#endif',
+ \ 'int func_a(void);',
+ \ '#ifdef __cplusplus',
+ \ '}',
+ \ '#endif'
+ \ ]
+
+ let with_ind = [
+ \ '#ifdef __cplusplus',
+ \ 'extern "C" {',
+ \ '#endif',
+ \ "\tint func_a(void);",
+ \ '#ifdef __cplusplus',
+ \ '}',
+ \ '#endif'
+ \ ]
+ new
+ setlocal cindent cinoptions=E0
+ call setline(1, without_ind)
+ call feedkeys("gg=G", 'tx')
+ call assert_equal(with_ind, getline(1, '$'))
+
+ setlocal cinoptions=E-s
+ call setline(1, with_ind)
+ call feedkeys("gg=G", 'tx')
+ call assert_equal(without_ind, getline(1, '$'))
+
+ setlocal cinoptions=Es
+ let tests = [
+ \ ['recognized', ['extern "C" {'], "\t\t;"],
+ \ ['recognized', ['extern "C++" {'], "\t\t;"],
+ \ ['recognized', ['extern /* com */ "C"{'], "\t\t;"],
+ \ ['recognized', ['extern"C"{'], "\t\t;"],
+ \ ['recognized', ['extern "C"', '{'], "\t\t;"],
+ \ ['not recognized', ['extern {'], "\t;"],
+ \ ['not recognized', ['extern /*"C"*/{'], "\t;"],
+ \ ['not recognized', ['extern "C" //{'], ";"],
+ \ ['not recognized', ['extern "C" /*{*/'], ";"],
+ \ ]
+
+ for pair in tests
+ let lines = pair[1]
+ call setline(1, lines)
+ call feedkeys(len(lines) . "Go;", 'tx')
+ call assert_equal(pair[2], getline(len(lines) + 1), 'Failed for "' . string(lines) . '"')
+ endfor
+
+
+
+ bwipe!
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab