@@ -24,21 +24,25 @@ func Test_sort_strings()
2424
2525 " This does not appear to work correctly on Mac.
2626 if ! has (' mac' )
27- let lc = execute (' language collate' )
2827 " With the following locales, the accentuated letters are ordered
2928 " similarly to the non-accentuated letters...
30- if lc = ~? ' " \(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8" '
29+ if v: collate = ~? ' ^ \(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$ '
3130 call assert_equal ([' a' , ' A' , ' ä' , ' Ä' , ' o' , ' O' , ' ô' , ' Ô' , ' œ' , ' œ' , ' p' , ' P' ],
3231 \ sort ([' A' , ' a' , ' o' , ' O' , ' œ' , ' œ' , ' p' , ' P' , ' Ä' , ' ä' , ' ô' , ' Ô' ], ' l' ))
3332 " ... whereas with a Swedish locale, the accentuated letters are ordered
3433 " after Z.
35- elseif lc = ~? ' " sv.*utf-\?8" '
34+ elseif v: collate = ~? ' ^ sv.*utf-\?8$ '
3635 call assert_equal ([' a' , ' A' , ' o' , ' O' , ' p' , ' P' , ' ä' , ' Ä' , ' œ' , ' œ' , ' ô' , ' Ô' ],
3736 \ sort ([' A' , ' a' , ' o' , ' O' , ' œ' , ' œ' , ' p' , ' P' , ' Ä' , ' ä' , ' ô' , ' Ô' ], ' l' ))
3837 endif
3938 endif
4039endfunc
4140
41+ func Test_sort_null_string ()
42+ " null strings are sorted as empty strings.
43+ call assert_equal ([' ' , ' a' , ' b' ], sort ([' b' , test_null_string (), ' a' ]))
44+ endfunc
45+
4246func Test_sort_numeric ()
4347 call assert_equal ([1 , 2 , 3 ], sort ([3 , 2 , 1 ], ' n' ))
4448 call assert_equal ([3 , 13 , 28 ], sort ([13 , 28 , 3 ], ' n' ))
@@ -1229,8 +1233,7 @@ func Test_sort_cmd()
12291233 " With the following locales, the accentuated letters are ordered
12301234 " similarly to the non-accentuated letters.
12311235 " This does not appear to work on Mac
1232- let lc = execute (' language collate' )
1233- if lc = ~? ' "\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8"' && ! has (' mac' )
1236+ if v: collate = ~? ' ^\(en\|es\|de\|fr\|it\|nl\).*\.utf-\?8$' && ! has (' mac' )
12341237 let tests += [
12351238 \ {
12361239 \ ' name' : ' sort with locale' ,
0 commit comments