Adding new stuff
This commit is contained in:
parent
1f2c9e448a
commit
44142239cd
40 changed files with 16241 additions and 11 deletions
10
vim-plugins/bundle/targets.vim/test/Makefile
Normal file
10
vim-plugins/bundle/targets.vim/test/Makefile
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
all:
|
||||
@rm -f *.out
|
||||
@vim -N -u NONE --noplugin -S test.vim
|
||||
@git diff --no-index test1.ok test1.out && echo "test1 OK" || echo "test1 failed"
|
||||
@git diff --no-index test2.ok test2.out && echo "test2 OK" || echo "test2 failed"
|
||||
@git diff --no-index test3.ok test3.out && echo "test3 OK" || echo "test3 failed"
|
||||
@git diff --no-index test4.ok test4.out && echo "test4 OK" || echo "test4 failed"
|
||||
@git diff --no-index test5.ok test5.out && echo "test5 OK" || echo "test5 failed"
|
||||
@git diff --no-index test6.ok test6.out && echo "test6 OK" || echo "test6 failed"
|
||||
@git diff --no-index test7.ok test7.out && echo "test7 OK" || echo "test7 failed"
|
||||
253
vim-plugins/bundle/targets.vim/test/test.vim
Normal file
253
vim-plugins/bundle/targets.vim/test/test.vim
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
" targets.vim Provides additional text objects
|
||||
" Author: Christian Wellenbrock <christian.wellenbrock@gmail.com>
|
||||
" License: MIT license
|
||||
|
||||
set runtimepath+=../
|
||||
set softtabstop=16 expandtab
|
||||
source ../plugin/targets.vim
|
||||
|
||||
function! s:execute(operation, motions)
|
||||
if a:operation == 'c'
|
||||
execute "normal " . a:operation . a:motions . "_"
|
||||
elseif a:operation == 'v'
|
||||
execute "normal " . a:operation . a:motions
|
||||
normal r_
|
||||
else
|
||||
execute "normal " . a:operation . a:motions
|
||||
endif
|
||||
if a:operation == 'y'
|
||||
execute "normal A\<Tab>'\<C-R>\"'"
|
||||
endif
|
||||
execute "normal I" . a:operation . a:motions . "\<Tab>\<Esc>"
|
||||
endfunction
|
||||
|
||||
function! s:testBasic()
|
||||
edit test1.in
|
||||
normal gg0
|
||||
|
||||
for delset in [
|
||||
\ [ '(', ')', 'b' ],
|
||||
\ [ '{', '}', 'B' ],
|
||||
\ [ '[', ']' ],
|
||||
\ [ '<', '>' ],
|
||||
\ [ 't' ]
|
||||
\ ]
|
||||
normal "lyy
|
||||
|
||||
for op in [ 'c', 'd', 'y', 'v' ]
|
||||
for cnt in [ '', '1', '2' ]
|
||||
for ln in [ 'l', '', 'n' ]
|
||||
for iaIA in [ 'I', 'i', 'a', 'A' ]
|
||||
for del in delset
|
||||
execute "normal \"lpfx"
|
||||
call s:execute(op, cnt . iaIA . ln . del)
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
|
||||
normal +
|
||||
endfor
|
||||
|
||||
normal +
|
||||
|
||||
for del in [ "'", '"', '`' ]
|
||||
normal "lyy
|
||||
|
||||
for op in [ 'c', 'd', 'y', 'v' ]
|
||||
for cnt in [ '', '1', '2' ]
|
||||
for LlnN in [ 'l', '', 'n' ]
|
||||
for iaIA in [ 'I', 'i', 'a', 'A' ]
|
||||
execute "normal \"lpfx"
|
||||
call s:execute(op, cnt . iaIA . LlnN . del)
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
|
||||
normal +
|
||||
endfor
|
||||
|
||||
normal +
|
||||
|
||||
for del in [ ',', '.', ';', ':', '+', '-', '=', '~', '_', '*', '#', '/', '|', '\', '&', '$' ]
|
||||
normal "lyy
|
||||
|
||||
for op in [ 'c', 'd', 'y', 'v' ]
|
||||
for cnt in [ '', '1', '2' ]
|
||||
for LlnN in [ 'L', 'l', '', 'n', 'N' ]
|
||||
for iaIA in [ 'I', 'i', 'a', 'A' ]
|
||||
execute "normal \"lpfx"
|
||||
call s:execute(op, cnt . iaIA . LlnN . del)
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
|
||||
normal +
|
||||
endfor
|
||||
|
||||
normal +
|
||||
|
||||
normal "lyy
|
||||
|
||||
for op in [ 'c', 'd', 'y', 'v' ]
|
||||
for cnt in [ '', '1', '2' ]
|
||||
for ln in [ 'l', '', 'n' ]
|
||||
for iaIA in [ 'I', 'i', 'a', 'A' ]
|
||||
execute "normal \"lpfx"
|
||||
call s:execute(op, cnt . iaIA . ln . 'a')
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
|
||||
write! test1.out
|
||||
endfunction
|
||||
|
||||
function! s:testMultiline()
|
||||
edit! test2.in
|
||||
normal gg0
|
||||
|
||||
execute "normal /comment 1\<CR>"
|
||||
set autoindent
|
||||
execute "normal cin{foo\<Esc>"
|
||||
set autoindent&
|
||||
|
||||
execute "normal /comment 2\<CR>"
|
||||
execute "normal din{"
|
||||
|
||||
execute "normal /comment 3\<CR>"
|
||||
execute "normal cin;foo\<Esc>"
|
||||
|
||||
execute "normal /comment 4\<CR>"
|
||||
execute "normal cin`foo\<Esc>"
|
||||
|
||||
execute "normal /comment 5\<CR>"
|
||||
execute "normal cI{foo\<Esc>"
|
||||
|
||||
write! test2.out
|
||||
endfunction
|
||||
|
||||
function s:testSeeking()
|
||||
edit! test3.in
|
||||
normal gg0
|
||||
|
||||
for c in split('ABCDEFGHI', '\zs')
|
||||
execute "normal /" . c . "\<CR>"
|
||||
execute "normal ci)" . c . "\<Esc>"
|
||||
endfor
|
||||
|
||||
for c in split('JKLMNO', '\zs')
|
||||
execute "normal /" . c . "\<CR>"
|
||||
execute "normal ci'" . c . "\<Esc>"
|
||||
endfor
|
||||
|
||||
write! test3.out
|
||||
endfunction
|
||||
|
||||
function s:testVisual()
|
||||
edit! test4.in
|
||||
normal gg0
|
||||
|
||||
for delset in [
|
||||
\ [ '(', ')', 'b' ],
|
||||
\ [ '{', '}', 'B' ],
|
||||
\ [ '[', ']' ],
|
||||
\ [ '<', '>' ],
|
||||
\ [ 't' ]
|
||||
\ ]
|
||||
normal "lyy
|
||||
|
||||
for ia in [ 'i', 'a' ]
|
||||
for del in delset
|
||||
normal "lpfx
|
||||
execute "normal v" . ia . del . ia . del . "r_"
|
||||
endfor
|
||||
endfor
|
||||
|
||||
normal +
|
||||
endfor
|
||||
|
||||
|
||||
write! test4.out
|
||||
endfunction
|
||||
|
||||
function s:testModifiers()
|
||||
edit! test5.in
|
||||
normal gg0
|
||||
|
||||
normal fxvItr_
|
||||
|
||||
write! test5.out
|
||||
endfunction
|
||||
|
||||
function s:testEmpty()
|
||||
edit! test6.in
|
||||
normal gg0
|
||||
|
||||
normal ci"foo
|
||||
|
||||
normal +
|
||||
|
||||
normal ci(foo
|
||||
|
||||
normal +
|
||||
|
||||
normal ci,foo
|
||||
|
||||
write! test6.out
|
||||
endfunction
|
||||
|
||||
function s:testQuotes()
|
||||
edit! test7.in
|
||||
normal gg0
|
||||
|
||||
normal ci"A
|
||||
normal +
|
||||
normal cin"A
|
||||
normal +
|
||||
normal c2in"B
|
||||
|
||||
normal +fx
|
||||
normal ci"D
|
||||
normal +fx
|
||||
normal cin"D
|
||||
normal +fx
|
||||
normal c2in"E
|
||||
normal +fx
|
||||
normal cil"C
|
||||
normal +fx
|
||||
normal c2il"B
|
||||
|
||||
normal +fx
|
||||
normal ci"X
|
||||
normal +fx
|
||||
normal cin"D
|
||||
normal +fx
|
||||
normal c2in"E
|
||||
normal +fx
|
||||
normal cil"C
|
||||
normal +fx
|
||||
normal c2il"B
|
||||
|
||||
normal +fx
|
||||
normal ci"C
|
||||
normal +fx
|
||||
normal cil"C
|
||||
normal +fx
|
||||
normal c2il"B
|
||||
|
||||
write! test7.out
|
||||
endfunction
|
||||
|
||||
call s:testBasic()
|
||||
call s:testMultiline()
|
||||
call s:testSeeking()
|
||||
call s:testVisual()
|
||||
call s:testModifiers()
|
||||
call s:testEmpty()
|
||||
call s:testQuotes()
|
||||
|
||||
quit!
|
||||
28
vim-plugins/bundle/targets.vim/test/test1.in
Normal file
28
vim-plugins/bundle/targets.vim/test/test1.in
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
a ( b ) ( c ) ( ( x ) ) ( e ) ( f ) g
|
||||
a { b } { c } { { x } } { e } { f } g
|
||||
a [ b ] [ c ] [ [ x ] ] [ e ] [ f ] g
|
||||
a < b > < c > < < x > > < e > < f > g
|
||||
a <a> b </a> <b> c </b> <c> <d> x </d> </c> <e> e </e> <f> f </f> g
|
||||
|
||||
a ' b ' c ' d ' e ' x ' g ' h ' i ' k ' l
|
||||
a " b " c " d " e " x " g " h " i " k " l
|
||||
a ` b ` c ` d ` e ` x ` g ` h ` i ` k ` l
|
||||
|
||||
a , b , c , d , e , x , g , h , i , k , l
|
||||
a . b . c . d . e . x . g . h . i . k . l
|
||||
a ; b ; c ; d ; e ; x ; g ; h ; i ; k ; l
|
||||
a : b : c : d : e : x : g : h : i : k : l
|
||||
a + b + c + d + e + x + g + h + i + k + l
|
||||
a - b - c - d - e - x - g - h - i - k - l
|
||||
a = b = c = d = e = x = g = h = i = k = l
|
||||
a ~ b ~ c ~ d ~ e ~ x ~ g ~ h ~ i ~ k ~ l
|
||||
a _ b _ c _ d _ e _ x _ g _ h _ i _ k _ l
|
||||
a * b * c * d * e * x * g * h * i * k * l
|
||||
a # b # c # d # e # x # g # h # i # k # l
|
||||
a / b / c / d / e / x / g / h / i / k / l
|
||||
a | b | c | d | e | x | g | h | i | k | l
|
||||
a \ b \ c \ d \ e \ x \ g \ h \ i \ k \ l
|
||||
a & b & c & d & e & x & g & h & i & k & l
|
||||
a $ b $ c $ d $ e $ x $ g $ h $ i $ k $ l
|
||||
|
||||
a ( b , c ( d ) , d ( x , e ) , f ) g
|
||||
6028
vim-plugins/bundle/targets.vim/test/test1.ok
Normal file
6028
vim-plugins/bundle/targets.vim/test/test1.ok
Normal file
File diff suppressed because it is too large
Load diff
6028
vim-plugins/bundle/targets.vim/test/test1.out
Normal file
6028
vim-plugins/bundle/targets.vim/test/test1.out
Normal file
File diff suppressed because it is too large
Load diff
25
vim-plugins/bundle/targets.vim/test/test2.in
Normal file
25
vim-plugins/bundle/targets.vim/test/test2.in
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// comment 1
|
||||
function f() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
// comment 2
|
||||
function f() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
// comment 3
|
||||
int a = 5;
|
||||
int b = a > 0
|
||||
? 1
|
||||
: 2;
|
||||
|
||||
// comment 4
|
||||
string x = `line 1
|
||||
line 2
|
||||
line 3`;
|
||||
|
||||
// comment 5
|
||||
function f() {
|
||||
return 4;
|
||||
}
|
||||
20
vim-plugins/bundle/targets.vim/test/test2.ok
Normal file
20
vim-plugins/bundle/targets.vim/test/test2.ok
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// comment 1
|
||||
function f() {
|
||||
foo
|
||||
}
|
||||
|
||||
// comment 2
|
||||
function f() {
|
||||
}
|
||||
|
||||
// comment 3
|
||||
int a = 5;
|
||||
foo;
|
||||
|
||||
// comment 4
|
||||
string x = `foo`;
|
||||
|
||||
// comment 5
|
||||
function f() {
|
||||
foo
|
||||
}
|
||||
20
vim-plugins/bundle/targets.vim/test/test2.out
Normal file
20
vim-plugins/bundle/targets.vim/test/test2.out
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// comment 1
|
||||
function f() {
|
||||
foo
|
||||
}
|
||||
|
||||
// comment 2
|
||||
function f() {
|
||||
}
|
||||
|
||||
// comment 3
|
||||
int a = 5;
|
||||
foo;
|
||||
|
||||
// comment 4
|
||||
string x = `foo`;
|
||||
|
||||
// comment 5
|
||||
function f() {
|
||||
foo
|
||||
}
|
||||
42
vim-plugins/bundle/targets.vim/test/test3.in
Normal file
42
vim-plugins/bundle/targets.vim/test/test3.in
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
A
|
||||
a ( b ) c
|
||||
|
||||
B ( a ) b
|
||||
a ( b ) C
|
||||
|
||||
D ( a
|
||||
b ) c
|
||||
|
||||
a ( b
|
||||
c ) E
|
||||
|
||||
a ( b
|
||||
F ( ) c
|
||||
d ) e
|
||||
|
||||
a ( b
|
||||
c ( ) G
|
||||
d ) e
|
||||
|
||||
a ( b ) H ( c ) d
|
||||
|
||||
a ( b ) c
|
||||
I " this must be the last pair test
|
||||
|
||||
J
|
||||
a 'b' c
|
||||
|
||||
K 'a' b
|
||||
a 'b' L
|
||||
|
||||
a ' b
|
||||
M ' c
|
||||
d ' e
|
||||
|
||||
a ' b
|
||||
c ' N
|
||||
d ' e
|
||||
|
||||
a ' b ' c
|
||||
O " this must be the last quote test
|
||||
|
||||
38
vim-plugins/bundle/targets.vim/test/test3.ok
Normal file
38
vim-plugins/bundle/targets.vim/test/test3.ok
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
A
|
||||
a (A) c
|
||||
|
||||
B (B) b
|
||||
a (C) C
|
||||
|
||||
D (D) c
|
||||
|
||||
a (E) E
|
||||
|
||||
a ( b
|
||||
F (F) c
|
||||
d ) e
|
||||
|
||||
a ( b
|
||||
c (G) G
|
||||
d ) e
|
||||
|
||||
a ( b ) H (H) d
|
||||
|
||||
a (I) c
|
||||
I " this must be the last pair test
|
||||
|
||||
J
|
||||
a 'J' c
|
||||
|
||||
K 'K' b
|
||||
a 'L' L
|
||||
|
||||
a 'M' c
|
||||
d ' e
|
||||
|
||||
a ' b
|
||||
c 'N' e
|
||||
|
||||
a 'O' c
|
||||
O " this must be the last quote test
|
||||
|
||||
38
vim-plugins/bundle/targets.vim/test/test3.out
Normal file
38
vim-plugins/bundle/targets.vim/test/test3.out
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
A
|
||||
a (A) c
|
||||
|
||||
B (B) b
|
||||
a (C) C
|
||||
|
||||
D (D) c
|
||||
|
||||
a (E) E
|
||||
|
||||
a ( b
|
||||
F (F) c
|
||||
d ) e
|
||||
|
||||
a ( b
|
||||
c (G) G
|
||||
d ) e
|
||||
|
||||
a ( b ) H (H) d
|
||||
|
||||
a (I) c
|
||||
I " this must be the last pair test
|
||||
|
||||
J
|
||||
a 'J' c
|
||||
|
||||
K 'K' b
|
||||
a 'L' L
|
||||
|
||||
a 'M' c
|
||||
d ' e
|
||||
|
||||
a ' b
|
||||
c 'N' e
|
||||
|
||||
a 'O' c
|
||||
O " this must be the last quote test
|
||||
|
||||
6
vim-plugins/bundle/targets.vim/test/test4.in
Normal file
6
vim-plugins/bundle/targets.vim/test/test4.in
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
a ( b ( x ) c ) d
|
||||
a { b { x } c } d
|
||||
a [ b [ x ] c ] d
|
||||
a < b < x > c > d
|
||||
a <a> b <b> x </b> c </a> d
|
||||
|
||||
28
vim-plugins/bundle/targets.vim/test/test4.ok
Normal file
28
vim-plugins/bundle/targets.vim/test/test4.ok
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
a ( b ( x ) c ) d
|
||||
a (___________) d
|
||||
a (___________) d
|
||||
a (___________) d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a { b { x } c } d
|
||||
a {___________} d
|
||||
a {___________} d
|
||||
a {___________} d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a [ b [ x ] c ] d
|
||||
a [___________] d
|
||||
a [___________] d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a < b < x > c > d
|
||||
a <___________> d
|
||||
a <___________> d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a <a> b <b> x </b> c </a> d
|
||||
a <a>________________</a> d
|
||||
a _______________________ d
|
||||
|
||||
28
vim-plugins/bundle/targets.vim/test/test4.out
Normal file
28
vim-plugins/bundle/targets.vim/test/test4.out
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
a ( b ( x ) c ) d
|
||||
a (___________) d
|
||||
a (___________) d
|
||||
a (___________) d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a { b { x } c } d
|
||||
a {___________} d
|
||||
a {___________} d
|
||||
a {___________} d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a [ b [ x ] c ] d
|
||||
a [___________] d
|
||||
a [___________] d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a < b < x > c > d
|
||||
a <___________> d
|
||||
a <___________> d
|
||||
a _____________ d
|
||||
a _____________ d
|
||||
a <a> b <b> x </b> c </a> d
|
||||
a <a>________________</a> d
|
||||
a _______________________ d
|
||||
|
||||
1
vim-plugins/bundle/targets.vim/test/test5.in
Normal file
1
vim-plugins/bundle/targets.vim/test/test5.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
<a>axb</a>
|
||||
1
vim-plugins/bundle/targets.vim/test/test5.ok
Normal file
1
vim-plugins/bundle/targets.vim/test/test5.ok
Normal file
|
|
@ -0,0 +1 @@
|
|||
<a>___</a>
|
||||
1
vim-plugins/bundle/targets.vim/test/test5.out
Normal file
1
vim-plugins/bundle/targets.vim/test/test5.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
<a>___</a>
|
||||
3
vim-plugins/bundle/targets.vim/test/test6.in
Normal file
3
vim-plugins/bundle/targets.vim/test/test6.in
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a "" b
|
||||
a () b
|
||||
a ,, b
|
||||
3
vim-plugins/bundle/targets.vim/test/test6.ok
Normal file
3
vim-plugins/bundle/targets.vim/test/test6.ok
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a "foo" b
|
||||
a (foo) b
|
||||
a ,foo, b
|
||||
3
vim-plugins/bundle/targets.vim/test/test6.out
Normal file
3
vim-plugins/bundle/targets.vim/test/test6.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a "foo" b
|
||||
a (foo) b
|
||||
a ,foo, b
|
||||
16
vim-plugins/bundle/targets.vim/test/test7.in
Normal file
16
vim-plugins/bundle/targets.vim/test/test7.in
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
x "a" "b" c
|
||||
x "a" "b" c
|
||||
x "a" "b" c
|
||||
a "b" "c" x "d" "e" f
|
||||
a "b" "c" x "d" "e" f
|
||||
a "b" "c" x "d" "e" f
|
||||
a "b" "c" x "d" "e" f
|
||||
a "b" "c" x "d" "e" f
|
||||
a "b" "c" "x" "d" "e" f
|
||||
a "b" "c" "x" "d" "e" f
|
||||
a "b" "c" "x" "d" "e" f
|
||||
a "b" "c" "x" "d" "e" f
|
||||
a "b" "c" "x" "d" "e" f
|
||||
a "b" "c" x
|
||||
a "b" "c" x
|
||||
a "b" "c" x
|
||||
16
vim-plugins/bundle/targets.vim/test/test7.ok
Normal file
16
vim-plugins/bundle/targets.vim/test/test7.ok
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
x "A" "b" c
|
||||
x "A" "b" c
|
||||
x "a" "B" c
|
||||
a "b" "c" x "D" "e" f
|
||||
a "b" "c" x "D" "e" f
|
||||
a "b" "c" x "d" "E" f
|
||||
a "b" "C" x "d" "e" f
|
||||
a "B" "c" x "d" "e" f
|
||||
a "b" "c" "X" "d" "e" f
|
||||
a "b" "c" "x" "D" "e" f
|
||||
a "b" "c" "x" "d" "E" f
|
||||
a "b" "C" "x" "d" "e" f
|
||||
a "B" "c" "x" "d" "e" f
|
||||
a "b" "C" x
|
||||
a "b" "C" x
|
||||
a "B" "c" x
|
||||
16
vim-plugins/bundle/targets.vim/test/test7.out
Normal file
16
vim-plugins/bundle/targets.vim/test/test7.out
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
x "A" "b" c
|
||||
x "A" "b" c
|
||||
x "a" "B" c
|
||||
a "b" "c" x "D" "e" f
|
||||
a "b" "c" x "D" "e" f
|
||||
a "b" "c" x "d" "E" f
|
||||
a "b" "C" x "d" "e" f
|
||||
a "B" "c" x "d" "e" f
|
||||
a "b" "c" "X" "d" "e" f
|
||||
a "b" "c" "x" "D" "e" f
|
||||
a "b" "c" "x" "d" "E" f
|
||||
a "b" "C" "x" "d" "e" f
|
||||
a "B" "c" "x" "d" "e" f
|
||||
a "b" "C" x
|
||||
a "b" "C" x
|
||||
a "B" "c" x
|
||||
Loading…
Add table
Add a link
Reference in a new issue