aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-08-20 12:24:34 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-08-20 12:24:34 -0400
commit118a31c24c7ce76da909026cd10a94feb88803bc (patch)
tree8bbd708d924ef68017949e4bf9b773d5d833b82d /src/nvim/testdir
parentbbefc73c553d681f78f40df9d97ec89ae9b06520 (diff)
parent3b0f7fe59392138c886063b09e3cf41b25d53056 (diff)
downloadrneovim-118a31c24c7ce76da909026cd10a94feb88803bc.tar.gz
rneovim-118a31c24c7ce76da909026cd10a94feb88803bc.tar.bz2
rneovim-118a31c24c7ce76da909026cd10a94feb88803bc.zip
Merge pull request #691 from fmoralesc/master
Port vim's breakindent patch to neovim's codebase. (vim patches 7.4.338, 7.4.346, 7.4.352, 7.4.353, 7.4.370, 7.4.371, 7.4.388)
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/Makefile6
-rw-r--r--src/nvim/testdir/test_breakindent.in79
-rw-r--r--src/nvim/testdir/test_breakindent.ok55
-rw-r--r--src/nvim/testdir/test_listlbr.in52
-rw-r--r--src/nvim/testdir/test_listlbr.ok27
-rw-r--r--src/nvim/testdir/test_listlbr_utf8.in52
-rw-r--r--src/nvim/testdir/test_listlbr_utf8.ok21
7 files changed, 290 insertions, 2 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index a7f9dd8fa1..db88755a01 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -30,8 +30,10 @@ SCRIPTS := test_autoformat_join.out \
test91.out test92.out test93.out test94.out test95.out \
test96.out test97.out test98.out test99.out test100.out \
test101.out test102.out test103.out test104.out test105.out \
- test106.out test107.out \
- test_options.out
+ test106.out test107.out \
+ test_options.out \
+ test_listlbr.out test_listlbr_utf8.out \
+ test_breakindent.out
SCRIPTS_GUI := test16.out
diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in
new file mode 100644
index 0000000000..8f40e4f7e5
--- /dev/null
+++ b/src/nvim/testdir/test_breakindent.in
@@ -0,0 +1,79 @@
+Test for breakindent
+
+STARTTEST
+:so small.vim
+:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif
+:10new|:vsp|:vert resize 20
+:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
+:set ts=4 sw=4 sts=4 breakindent
+:fu! ScreenChar(width)
+: let c=''
+: for i in range(1,a:width)
+: let c.=nr2char(screenchar(line('.'), i))
+: endfor
+: let c.="\n"
+: for i in range(1,a:width)
+: let c.=nr2char(screenchar(line('.')+1, i))
+: endfor
+: let c.="\n"
+: for i in range(1,a:width)
+: let c.=nr2char(screenchar(line('.')+2, i))
+: endfor
+: return c
+:endfu
+:fu DoRecordScreen()
+: wincmd l
+: $put =printf(\"\n%s\", g:test)
+: $put =g:line1
+: wincmd p
+:endfu
+:let g:test="Test 1: Simple breakindent"
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test="Test 2: Simple breakindent + sbr=>>"
+:set sbr=>>
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test ="Test 3: Simple breakindent + briopt:sbr"
+:set briopt=sbr,min:0 sbr=++
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test ="Test 4: Simple breakindent + min width: 18"
+:set sbr= briopt=min:18
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test =" Test 5: Simple breakindent + shift by 2"
+:set briopt=shift:2,min:0
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test=" Test 6: Simple breakindent + shift by -1"
+:set briopt=shift:-1,min:0
+:let line1=ScreenChar(8)
+:call DoRecordScreen()
+:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
+:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
+:let line1=ScreenChar(10)
+:call DoRecordScreen()
+:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
+:set briopt=shift:1,sbr,min:0 nu sbr=# list
+:let line1=ScreenChar(10)
+:call DoRecordScreen()
+:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
+:set briopt-=sbr
+:let line1=ScreenChar(10)
+:call DoRecordScreen()
+:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
+:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
+:let line1=ScreenChar(10)
+:call DoRecordScreen()
+:wincmd p
+:let g:test="\n Test 11: strdisplaywidth when breakindent is on"
+:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
+:let text=getline(2) "skip leading tab when calculating text width
+:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
+:$put =g:test
+:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
+:%w! test.out
+:qa!
+ENDTEST
+dummy text
diff --git a/src/nvim/testdir/test_breakindent.ok b/src/nvim/testdir/test_breakindent.ok
new file mode 100644
index 0000000000..723cb25012
--- /dev/null
+++ b/src/nvim/testdir/test_breakindent.ok
@@ -0,0 +1,55 @@
+
+ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
+
+Test 1: Simple breakindent
+ abcd
+ qrst
+ GHIJ
+
+Test 2: Simple breakindent + sbr=>>
+ abcd
+ >>qr
+ >>EF
+
+Test 3: Simple breakindent + briopt:sbr
+ abcd
+++ qrst
+++ GHIJ
+
+Test 4: Simple breakindent + min width: 18
+ abcd
+ qrstuv
+ IJKLMN
+
+ Test 5: Simple breakindent + shift by 2
+ abcd
+ qr
+ EF
+
+ Test 6: Simple breakindent + shift by -1
+ abcd
+ qrstu
+ HIJKL
+
+ Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
+ 2 ab
+? m
+? x
+
+ Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
+ 2 ^Iabcd
+# opq
+# BCD
+
+ Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
+ 2 ^Iabcd
+ #op
+ #AB
+
+ Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
+ 2 ab
+~ mn
+~ yz
+
+ Test 11: strdisplaywidth when breakindent is on
+strdisplaywidth: 46 == calculated: 64
diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in
new file mode 100644
index 0000000000..0cce4c23a5
--- /dev/null
+++ b/src/nvim/testdir/test_listlbr.in
@@ -0,0 +1,52 @@
+Test for linebreak and list option (non-utf8)
+
+STARTTEST
+:so small.vim
+:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif
+:10new|:vsp|:vert resize 20
+:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"
+:norm! zt
+:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
+:fu! ScreenChar(width)
+: let c=''
+: for j in range(1,4)
+: for i in range(1,a:width)
+: let c.=nr2char(screenchar(j, i))
+: endfor
+: let c.="\n"
+: endfor
+: return c
+:endfu
+:fu! DoRecordScreen()
+: wincmd l
+: $put =printf(\"\n%s\", g:test)
+: $put =g:line
+: wincmd p
+:endfu
+:let g:test="Test 1: set linebreak"
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:let g:test="Test 2: set linebreak + set list"
+:set linebreak list listchars=
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:let g:test ="Test 3: set linebreak nolist"
+:set nolist linebreak
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"
+:set nolist linebreak ts=8
+:let line="1\t".repeat('a', winwidth(0)-2)
+:$put =line
+:$
+:norm! zt
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:%w! test.out
+:qa!
+ENDTEST
+dummy text
diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok
new file mode 100644
index 0000000000..be323d4dc7
--- /dev/null
+++ b/src/nvim/testdir/test_listlbr.ok
@@ -0,0 +1,27 @@
+
+ abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP
+
+Test 1: set linebreak
+ abcdef
++hijklmn
++pqrstuvwxyz_1060ABC
++DEFGHIJKLMNOP
+
+Test 2: set linebreak + set list
+^Iabcdef hijklmn^I
++pqrstuvwxyz_1060ABC
++DEFGHIJKLMNOP
+
+
+Test 3: set linebreak nolist
+ abcdef
++hijklmn
++pqrstuvwxyz_1060ABC
++DEFGHIJKLMNOP
+1 aaaaaaaaaaaaaaaaaa
+
+Test 4: set linebreak with tab and 1 line as long as screen: should break!
+1
++aaaaaaaaaaaaaaaaaa
+~
+~
diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in
new file mode 100644
index 0000000000..ba12adae05
--- /dev/null
+++ b/src/nvim/testdir/test_listlbr_utf8.in
@@ -0,0 +1,52 @@
+Test for linebreak and list option in utf-8 mode
+
+STARTTEST
+:so small.vim
+:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif
+:so mbyte.vim
+:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
+:10new|:vsp|:vert resize 20
+:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
+:norm! zt
+:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
+:fu! ScreenChar(width)
+: let c=''
+: for j in range(1,4)
+: for i in range(1,a:width)
+: let c.=nr2char(screenchar(j, i))
+: endfor
+: let c.="\n"
+: endfor
+: return c
+:endfu
+:fu! DoRecordScreen()
+: wincmd l
+: $put =printf(\"\n%s\", g:test)
+: $put =g:line
+: wincmd p
+:endfu
+:let g:test ="Test 1: set linebreak + set list + fancy listchars"
+:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:"
+:let g:test ="Test 2: set nolinebreak list"
+:set list nolinebreak
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:"
+:let g:test ="Test 3: set linebreak nolist"
+:$put =\"\t*mask = nil;\"
+:$
+:norm! zt
+:set nolist linebreak
+:redraw!
+:let line=ScreenChar(winwidth(0))
+:call DoRecordScreen()
+:"
+:%w! test.out
+:qa!
+ENDTEST
+dummy text
diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok
new file mode 100644
index 0000000000..634cf3906d
--- /dev/null
+++ b/src/nvim/testdir/test_listlbr_utf8.ok
@@ -0,0 +1,21 @@
+
+ abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP
+
+Test 1: set linebreak + set list + fancy listchars
+▕———abcdef
++hijklmn▕———
++pqrstuvwxyz␣1060ABC
++DEFGHIJKLMNOPˑ¶
+
+Test 2: set nolinebreak list
+▕———abcdef hijklmn▕—
++pqrstuvwxyz␣1060ABC
++DEFGHIJKLMNOPˑ¶
+ *mask = nil;
+
+Test 3: set linebreak nolist
+ *mask = nil;
+~
+~
+~