]> granicus.if.org Git - vim/commitdiff
patch 8.2.2287: sort test fails when locale is French Canadian v8.2.2287
authorBram Moolenaar <Bram@vim.org>
Sun, 3 Jan 2021 16:39:28 +0000 (17:39 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 3 Jan 2021 16:39:28 +0000 (17:39 +0100)
Problem:    Sort test fails when locale is French Canadian.
Solution:   Expect a different sort order. (Dominique Pellé, closes #7609)

src/testdir/test_sort.vim
src/version.c

index 42a44528f36efd20eabcefd6539f491fe59187c4..47c58594d77af9261f96266903dbaae3bdf00802 100644 (file)
@@ -16,23 +16,24 @@ func Test_sort_strings()
   call assert_equal([1, 2, 3], sort([3, 2, 1]))
   call assert_equal([13, 28, 3], sort([3, 28, 13]))
 
-  call assert_equal(['A', 'O', 'P', 'a', 'o', 'p', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\93', 'œ'],
-  \            sort(['A', 'O', 'P', 'a', 'o', 'p', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\93', 'Å\93']))
+  call assert_equal(['A', 'O', 'P', 'a', 'o', 'p', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\92', 'œ'],
+  \            sort(['A', 'O', 'P', 'a', 'o', 'p', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\93', 'Å\92']))
 
-  call assert_equal(['A', 'a', 'o', 'O', 'p', 'P', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\93', 'œ'],
-  \            sort(['A', 'a', 'o', 'O', 'Å\93', 'Å\93', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'i'))
+  call assert_equal(['A', 'a', 'o', 'O', 'p', 'P', 'Ã\84', 'Ã\94', 'ä', 'ô', 'Å\92', 'œ'],
+  \            sort(['A', 'a', 'o', 'O', 'Å\93', 'Å\92', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'i'))
 
   " This does not appear to work correctly on 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.
-      call assert_equal(['A', 'a', 'Ä', 'ä', 'O', 'o', 'Ô', 'ô', 'œ', 'œ', 'P', 'p'],
-      \            sort(['A', 'a', 'o', 'O', 'œ', 'œ', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
+      " 'Œ' is omitted because it can sort before or after 'œ'
+      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', 'ä', 'Ã\84', 'o', 'O', 'ô', 'Ã\94', 'Å\93', 'Å\93', 'p', 'P'],
-      \            sort(['A', 'a', 'o', 'O', 'Å\93', 'Å\93', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
+      call assert_equal(['a', 'A', 'ä', 'Ã\84', 'o', 'O', 'ô', 'Ã\94', 'Å\93', 'Å\92', 'p', 'P'],
+      \            sort(['A', 'a', 'o', 'O', 'Å\93', 'Å\92', 'p', 'P', 'Ä', 'ä', 'ô', 'Ô'], 'l'))
     elseif v:collate =~? '^sv.*utf-\?8$'
       " ... whereas with a Swedish locale, the accentuated letters are ordered
       " after Z.
@@ -1236,8 +1237,9 @@ func Test_sort_cmd()
 
     " This does not appear to work correctly on 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
+        " 'Œ' is omitted because it can sort before or after 'œ'
         let tests += [
           \ {
           \    'name' : 'sort with locale ' .. v:collate,
@@ -1250,7 +1252,6 @@ func Test_sort_cmd()
           \    'È',
           \    'É',
           \    'Ô',
-          \    'Œ',
           \    'Z',
           \    'a',
           \    'e',
@@ -1278,7 +1279,6 @@ func Test_sort_cmd()
           \    'Ô',
           \    'ô',
           \    'œ',
-          \    'Œ',
           \    'Z',
           \    'z'
           \    ]
index aa01a3920237364edb17d575d665928405b5337b..87d3c3dcc3d52c0af365fe24ccc957a7ef984eac 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2287,
 /**/
     2286,
 /**/