aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-04-20 01:18:55 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-04-20 10:12:09 +0100
commitb5dbd156f91b8e4d0525cc9cf91d73f4825fbb23 (patch)
treeab8c4bbc02e7f9f7a8d831a53b520a54f3c811fb
parent8c55a16e7d9ad14df797d17802ab749e20b433c7 (diff)
downloadrneovim-b5dbd156f91b8e4d0525cc9cf91d73f4825fbb23.tar.gz
rneovim-b5dbd156f91b8e4d0525cc9cf91d73f4825fbb23.tar.bz2
rneovim-b5dbd156f91b8e4d0525cc9cf91d73f4825fbb23.zip
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) https://github.com/vim/vim/commit/fefa6c347e2c7f01ed2b095084f4aa694ff72149
-rw-r--r--src/nvim/testdir/test_sort.vim164
1 files changed, 109 insertions, 55 deletions
diff --git a/src/nvim/testdir/test_sort.vim b/src/nvim/testdir/test_sort.vim
index 3b1dc4ae1c..5ed50c8d05 100644
--- a/src/nvim/testdir/test_sort.vim
+++ b/src/nvim/testdir/test_sort.vim
@@ -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