robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3 4local describe , it , before_each , pending =t . describe , t . it , t . before_each , t . pending 5local clear , insert , eq =n . clear , n . insert , t . eq 6local command , expect =n . command , n . expect 7local feed , eval =n . feed , n . eval 8 9describe ( 'gu and gU' , function () 10before_each ( clear ) 11 12it ( 'works in any locale with default casemap' , function () 13eq ( 'internal,keepascii' , eval ( '&casemap' )) 14insert ( 'iI' ) 15feed ( 'VgU' ) 16expect ( 'II' ) 17feed ( 'Vgu' ) 18expect ( 'ii' ) 19end ) 20 21describe ( 'works in Turkish locale' , function () 22clear () 23 24if not pcall ( n . command , 'lang ctype tr_TR.UTF-8' ) then 25pending ( 'Locale tr_TR.UTF-8 not supported' , function () end ) 26return 27end 28 29before_each ( function () 30command ( 'lang ctype tr_TR.UTF-8' ) 31end ) 32 33it ( 'with default casemap' , function () 34eq ( 'internal,keepascii' , eval ( '&casemap' )) 35-- expect ASCII behavior 36insert ( 'iI' ) 37feed ( 'VgU' ) 38expect ( 'II' ) 39feed ( 'Vgu' ) 40expect ( 'ii' ) 41end ) 42 43it ( 'with casemap=""' , function () 44command ( 'set casemap=' ) 45-- expect either Turkish locale behavior or ASCII behavior 46local iupper =eval ( "toupper('i')" ) 47if iupper == 'İ' then 48insert ( 'iI' ) 49feed ( 'VgU' ) 50expect ( 'İI' ) 51feed ( 'Vgu' ) 52expect ( 'iı' ) 53elseif iupper == 'I' then 54insert ( 'iI' ) 55feed ( 'VgU' ) 56expect ( 'II' ) 57feed ( 'Vgu' ) 58expect ( 'ii' ) 59else 60error ( "expected toupper('i') to be either 'I' or 'İ'" ) 61end 62end ) 63end ) 64end )