1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
Describe Quote balance magic should work
Before each
call autopairs#Variables#InitVariables()
End
It should do basic balancing
let g:AutoPairsMapBS = 0
new | only!
call Expect("'").ToMatch("''")
call Expect("''").ToMatch("''")
call Expect("''\<BS>").ToMatch('''')
call Expect("''\<BS>'").ToMatch("''")
End
It should be able to deal with strings
let g:AutoPairsStringHandlingMode = 1
new | only!
set ft=cpp
call Expect('func("Don''t acknowledge strings").then(''a').ToMatch('func("Don''t acknowledge strings").then(''a'')')
End
It shouldn't balance in a word
new | only!
" This is an edge case because balancing has to ignore things in words.
call Expect("Don't, shan't, isn't, '").ToMatch("Don't, shan't, isn't, '")
End
It should deal with non-hl strings that call for exclusion by ' regex
new | only!
call Expect("func('This is text").ToMatch("func('This is text')")
call Expect("func('This is text').func('More text").ToMatch("func('This is text').func('More text')")
End
It should handle edge cases better when there's strings involved
new | only!
call Expect("func(\"Don't, shan't, isn't, ain't\").func('yay")
\.ToMatch("func(\"Don't, shan't, isn't, ain't\").func('yay')")
End
It should also handle edge cases better when there's strings involved for other balance modes
new | only!
set ft=cpp
let b:AutoPairsStringHandlingMode = 1
call Expect("func(\"Don't, shan't, isn't, ain't\").func('yay")
\.ToMatch("func(\"Don't, shan't, isn't, ain't\").func('yay')")
let b:AutoPairsStringHandlingMode = 2
call Expect("func(\"Don't, shan't, isn't, ain't\").func('yay")
\.ToMatch("func(\"Don't, shan't, isn't, ain't\").func('yay')")
End
End
|