neovim/src/nvim/testdir/test_regexp_latin.vim

41 lines
1.1 KiB
VimL
Raw Normal View History

" Tests for regexp in latin1 encoding
set encoding=latin1
scriptencoding latin1
func s:equivalence_test()
let str = "A<><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD> B C D E<><45><EFBFBD><EFBFBD> F G H I<><49><EFBFBD><EFBFBD> J K L M N<> O<><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> P Q R S T U<><55><EFBFBD><EFBFBD> V W X Y<> Z a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b c d e<><65><EFBFBD><EFBFBD> f g h i<><69><EFBFBD><EFBFBD> j k l m n<> o<><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> p q r s t u<><75><EFBFBD><EFBFBD> v w x y<><79> z"
let groups = split(str)
for group1 in groups
for c in split(group1, '\zs')
" next statement confirms that equivalence class matches every
" character in group
call assert_match('^[[=' . c . '=]]*$', group1)
for group2 in groups
if group2 != group1
" next statement converts that equivalence class doesn't match
" a character in any other group
call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
endif
endfor
endfor
endfor
endfunc
func Test_equivalence_re1()
set re=1
call s:equivalence_test()
endfunc
func Test_equivalence_re2()
set re=2
call s:equivalence_test()
endfunc
func Test_range_with_newline()
new
call setline(1, "a")
call assert_equal(0, search("[ -*\\n- ]"))
call assert_equal(0, search("[ -*\\t-\\n]"))
bwipe!
endfunc