test: make locale dependent oldtest more reliable (#6526)

This commit is contained in:
Björn Linse 2017-04-15 15:06:50 +02:00 committed by Justin M. Keyes
parent 12fc1defd6
commit c70ab1a2e2

View File

@ -1606,12 +1606,13 @@ fun! Test_normal30_changecase()
norm! V~ norm! V~
call assert_equal('THIS IS A simple test: äüöss', getline('.')) call assert_equal('THIS IS A simple test: äüöss', getline('.'))
" Turkish ASCII turns to multi-byte. On Mac the Turkish locale is available " Turkish ASCII turns to multi-byte. On some systems Turkish locale
" but toupper()/tolower() don't do the right thing. " is available but toupper()/tolower() don't do the right thing.
if !has('mac') && !has('osx') try
try lang tr_TR.UTF-8
lang tr_TR.UTF-8 set casemap=
set casemap= let iupper = toupper('i')
if iupper == "\u0130"
call setline(1, 'iI') call setline(1, 'iI')
1normal gUU 1normal gUU
call assert_equal("\u0130I", getline(1)) call assert_equal("\u0130I", getline(1))
@ -1621,8 +1622,7 @@ fun! Test_normal30_changecase()
1normal guu 1normal guu
call assert_equal("i\u0131", getline(1)) call assert_equal("i\u0131", getline(1))
call assert_equal("i\u0131", tolower("iI")) call assert_equal("i\u0131", tolower("iI"))
elseif iupper == "I"
set casemap&
call setline(1, 'iI') call setline(1, 'iI')
1normal gUU 1normal gUU
call assert_equal("II", getline(1)) call assert_equal("II", getline(1))
@ -1632,13 +1632,25 @@ fun! Test_normal30_changecase()
1normal guu 1normal guu
call assert_equal("ii", getline(1)) call assert_equal("ii", getline(1))
call assert_equal("ii", tolower("iI")) call assert_equal("ii", tolower("iI"))
else
call assert_true(false, "expected toupper('i') to be either 'I' or '\u0131'")
endif
set casemap&
call setline(1, 'iI')
1normal gUU
call assert_equal("II", getline(1))
call assert_equal("II", toupper("iI"))
lang en_US.UTF-8 call setline(1, 'iI')
catch /E197:/ 1normal guu
" can't use Turkish locale call assert_equal("ii", getline(1))
throw 'Skipped: Turkish locale not available' call assert_equal("ii", tolower("iI"))
endtry
endif lang en_US.UTF-8
catch /E197:/
" can't use Turkish locale
throw 'Skipped: Turkish locale not available'
endtry
" clean up " clean up
bw! bw!