changeset 23487:711a5b2e2cc9 v8.2.2286

patch 8.2.2286: sort test fails when locale is Canadian English Commit: https://github.com/vim/vim/commit/fefa6c347e2c7f01ed2b095084f4aa694ff72149 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 3 16:18:04 2021 +0100 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 https://github.com/vim/vim/issues/7609)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Jan 2021 16:30:04 +0100
parents a11a6ebfb210
children 8033272f88fc
files src/testdir/test_sort.vim src/version.c
diffstat 2 files changed, 111 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_sort.vim
+++ b/src/testdir/test_sort.vim
@@ -24,14 +24,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
@@ -1230,56 +1234,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
   if has('float')
     let tests += [
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2286,
+/**/
     2285,
 /**/
     2284,