mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2286: sort test fails when locale is Canadian English
Problem: Sort test fails when locale is Canadian English. (Neil H Watson)
Solution: Expect a different sort order. (closes vim/vim#7609)
fefa6c347e
This commit is contained in:
parent
8c55a16e7d
commit
b5dbd156f9
@ -22,14 +22,18 @@ func Test_sort_strings()
|
||||
|
||||
" This does not appear to work correctly on Mac.
|
||||
if !has('mac')
|
||||
" With the following locales, the accentuated letters are ordered
|
||||
" similarly to the non-accentuated letters...
|
||||
if v:collate =~? '^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$'
|
||||
if v:collate =~? '^en_ca.*\.utf-\?8$' && !has('mac')
|
||||
" with Canadian English capitals come before lower case.
|
||||
call assert_equal(['A', 'a', 'Ä', 'ä', 'O', 'o', 'Ô', 'ô', 'œ', 'œ', 'P', 'p'],
|
||||
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
|
||||
elseif v:collate =~? '^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$'
|
||||
" With the following locales, the accentuated letters are ordered
|
||||
" similarly to the non-accentuated letters...
|
||||
call assert_equal(['a', 'A', 'ä', 'Ä', 'o', 'O', 'ô', 'Ô', 'œ', 'œ', 'p', 'P'],
|
||||
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
|
||||
" ... whereas with a Swedish locale, the accentuated letters are ordered
|
||||
" after Z.
|
||||
elseif v:collate =~? '^sv.*utf-\?8$'
|
||||
" ... whereas with a Swedish locale, the accentuated letters are ordered
|
||||
" after Z.
|
||||
call assert_equal(['a', 'A', 'o', 'O', 'p', 'P', 'ä', 'Ä', 'œ', 'œ', 'ô', 'Ô'],
|
||||
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
|
||||
endif
|
||||
@ -1249,56 +1253,106 @@ func Test_sort_cmd()
|
||||
\ },
|
||||
\ ]
|
||||
|
||||
" With the following locales, the accentuated letters are ordered
|
||||
" similarly to the non-accentuated letters.
|
||||
" This does not appear to work on Mac
|
||||
if v:collate =~? '^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$' && !has('mac')
|
||||
let tests += [
|
||||
\ {
|
||||
\ 'name' : 'sort with locale',
|
||||
\ 'cmd' : '%sort l',
|
||||
\ 'input' : [
|
||||
\ 'A',
|
||||
\ 'E',
|
||||
\ 'O',
|
||||
\ 'À',
|
||||
\ 'È',
|
||||
\ 'É',
|
||||
\ 'Ô',
|
||||
\ 'Œ',
|
||||
\ 'Z',
|
||||
\ 'a',
|
||||
\ 'e',
|
||||
\ 'o',
|
||||
\ 'à',
|
||||
\ 'è',
|
||||
\ 'é',
|
||||
\ 'ô',
|
||||
\ 'œ',
|
||||
\ 'z'
|
||||
\ ],
|
||||
\ 'expected' : [
|
||||
\ 'a',
|
||||
\ 'A',
|
||||
\ 'à',
|
||||
\ 'À',
|
||||
\ 'e',
|
||||
\ 'E',
|
||||
\ 'é',
|
||||
\ 'É',
|
||||
\ 'è',
|
||||
\ 'È',
|
||||
\ 'o',
|
||||
\ 'O',
|
||||
\ 'ô',
|
||||
\ 'Ô',
|
||||
\ 'œ',
|
||||
\ 'Œ',
|
||||
\ 'z',
|
||||
\ 'Z'
|
||||
\ ]
|
||||
\ },
|
||||
\ ]
|
||||
" This does not appear to work correctly on Mac.
|
||||
if !has('mac')
|
||||
if v:collate =~? '^en_ca.*\.utf-\?8$'
|
||||
" en_CA.utf-8 sorts capitals before lower case
|
||||
let tests += [
|
||||
\ {
|
||||
\ 'name' : 'sort with locale ' .. v:collate,
|
||||
\ 'cmd' : '%sort l',
|
||||
\ 'input' : [
|
||||
\ 'A',
|
||||
\ 'E',
|
||||
\ 'O',
|
||||
\ 'À',
|
||||
\ 'È',
|
||||
\ 'É',
|
||||
\ 'Ô',
|
||||
\ 'Œ',
|
||||
\ 'Z',
|
||||
\ 'a',
|
||||
\ 'e',
|
||||
\ 'o',
|
||||
\ 'à',
|
||||
\ 'è',
|
||||
\ 'é',
|
||||
\ 'ô',
|
||||
\ 'œ',
|
||||
\ 'z'
|
||||
\ ],
|
||||
\ 'expected' : [
|
||||
\ 'A',
|
||||
\ 'a',
|
||||
\ 'À',
|
||||
\ 'à',
|
||||
\ 'E',
|
||||
\ 'e',
|
||||
\ 'É',
|
||||
\ 'é',
|
||||
\ 'È',
|
||||
\ 'è',
|
||||
\ 'O',
|
||||
\ 'o',
|
||||
\ 'Ô',
|
||||
\ 'ô',
|
||||
\ 'œ',
|
||||
\ 'Œ',
|
||||
\ 'Z',
|
||||
\ 'z'
|
||||
\ ]
|
||||
\ },
|
||||
\ ]
|
||||
elseif v:collate =~? '^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$'
|
||||
" With these locales, the accentuated letters are ordered
|
||||
" similarly to the non-accentuated letters.
|
||||
let tests += [
|
||||
\ {
|
||||
\ 'name' : 'sort with locale ' .. v:collate,
|
||||
\ 'cmd' : '%sort l',
|
||||
\ 'input' : [
|
||||
\ 'A',
|
||||
\ 'E',
|
||||
\ 'O',
|
||||
\ 'À',
|
||||
\ 'È',
|
||||
\ 'É',
|
||||
\ 'Ô',
|
||||
\ 'Œ',
|
||||
\ 'Z',
|
||||
\ 'a',
|
||||
\ 'e',
|
||||
\ 'o',
|
||||
\ 'à',
|
||||
\ 'è',
|
||||
\ 'é',
|
||||
\ 'ô',
|
||||
\ 'œ',
|
||||
\ 'z'
|
||||
\ ],
|
||||
\ 'expected' : [
|
||||
\ 'a',
|
||||
\ 'A',
|
||||
\ 'à',
|
||||
\ 'À',
|
||||
\ 'e',
|
||||
\ 'E',
|
||||
\ 'é',
|
||||
\ 'É',
|
||||
\ 'è',
|
||||
\ 'È',
|
||||
\ 'o',
|
||||
\ 'O',
|
||||
\ 'ô',
|
||||
\ 'Ô',
|
||||
\ 'œ',
|
||||
\ 'Œ',
|
||||
\ 'z',
|
||||
\ 'Z'
|
||||
\ ]
|
||||
\ },
|
||||
\ ]
|
||||
endif
|
||||
endif
|
||||
|
||||
for t in tests
|
||||
|
Loading…
Reference in New Issue
Block a user