1
0
forked from aniani/vim

patch 8.2.2287: sort test fails when locale is French Canadian

Problem:    Sort test fails when locale is French Canadian.
Solution:   Expect a different sort order. (Dominique Pellé, closes #7609)
This commit is contained in:
Bram Moolenaar
2021-01-03 17:39:28 +01:00
parent fefa6c347e
commit cec77d4530
2 changed files with 14 additions and 12 deletions

View File

@@ -16,23 +16,24 @@ func Test_sort_strings()
call assert_equal([1, 2, 3], sort([3, 2, 1])) call assert_equal([1, 2, 3], sort([3, 2, 1]))
call assert_equal([13, 28, 3], sort([3, 28, 13])) call assert_equal([13, 28, 3], sort([3, 28, 13]))
call assert_equal(['A', 'O', 'P', 'a', 'o', 'p', 'Ä', 'Ô', 'ä', 'ô', 'œ', 'œ'], call assert_equal(['A', 'O', 'P', 'a', 'o', 'p', 'Ä', 'Ô', 'ä', 'ô', 'Œ', 'œ'],
\ sort(['A', 'O', 'P', 'a', 'o', 'p', 'Ä', 'Ô', 'ä', 'ô', 'œ', 'œ'])) \ sort(['A', 'O', 'P', 'a', 'o', 'p', 'Ä', 'Ô', 'ä', 'ô', 'œ', 'Œ']))
call assert_equal(['A', 'a', 'o', 'O', 'p', 'P', 'Ä', 'Ô', 'ä', 'ô', 'œ', 'œ'], call assert_equal(['A', 'a', 'o', 'O', 'p', 'P', 'Ä', 'Ô', 'ä', 'ô', 'Œ', 'œ'],
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'i')) \ sort(['A', 'a', 'o', 'O', 'œ', 'Œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'i'))
" This does not appear to work correctly on Mac. " This does not appear to work correctly on Mac.
if !has('mac') if !has('mac')
if v:collate =~? '^en_ca.*\.utf-\?8$' && !has('mac') if v:collate =~? '^\(en\|fr\)_ca.utf-\?8$'
" with Canadian English capitals come before lower case. " with Canadian English capitals come before lower case.
call assert_equal(['A', 'a', 'Ä', 'ä', 'O', 'o', 'Ô', 'ô', 'œ', 'œ', 'P', 'p'], " 'Œ' is omitted because it can sort before or after 'œ'
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l')) 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$' elseif v:collate =~? '^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$'
" With the following locales, the accentuated letters are ordered " With the following locales, the accentuated letters are ordered
" similarly to the non-accentuated letters... " similarly to the non-accentuated letters...
call assert_equal(['a', 'A', 'ä', 'Ä', 'o', 'O', 'ô', 'Ô', 'œ', 'œ', 'p', 'P'], call assert_equal(['a', 'A', 'ä', 'Ä', 'o', 'O', 'ô', 'Ô', 'œ', 'Œ', 'p', 'P'],
\ sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l')) \ sort(['A', 'a', 'o', 'O', 'œ', 'Œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
elseif v:collate =~? '^sv.*utf-\?8$' elseif v:collate =~? '^sv.*utf-\?8$'
" ... whereas with a Swedish locale, the accentuated letters are ordered " ... whereas with a Swedish locale, the accentuated letters are ordered
" after Z. " after Z.
@@ -1236,8 +1237,9 @@ func Test_sort_cmd()
" This does not appear to work correctly on Mac. " This does not appear to work correctly on Mac.
if !has('mac') if !has('mac')
if v:collate =~? '^en_ca.*\.utf-\?8$' if v:collate =~? '^\(en\|fr\)_ca.utf-\?8$'
" en_CA.utf-8 sorts capitals before lower case " en_CA.utf-8 sorts capitals before lower case
" 'Œ' is omitted because it can sort before or after 'œ'
let tests += [ let tests += [
\ { \ {
\ 'name' : 'sort with locale ' .. v:collate, \ 'name' : 'sort with locale ' .. v:collate,
@@ -1250,7 +1252,6 @@ func Test_sort_cmd()
\ 'È', \ 'È',
\ 'É', \ 'É',
\ 'Ô', \ 'Ô',
\ 'Œ',
\ 'Z', \ 'Z',
\ 'a', \ 'a',
\ 'e', \ 'e',
@@ -1278,7 +1279,6 @@ func Test_sort_cmd()
\ 'Ô', \ 'Ô',
\ 'ô', \ 'ô',
\ 'œ', \ 'œ',
\ 'Œ',
\ 'Z', \ 'Z',
\ 'z' \ 'z'
\ ] \ ]

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2287,
/**/ /**/
2286, 2286,
/**/ /**/