mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4451: sort() fails when ignoring case
Problem: sort() fails when ignoring case. Solution: Accept a number one argument in sort().
This commit is contained in:
parent
2afeb40831
commit
9cd4c0fb98
@ -603,6 +603,7 @@ arg_sort_how(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
|
|||||||
{
|
{
|
||||||
if (type->tt_type == VAR_STRING
|
if (type->tt_type == VAR_STRING
|
||||||
|| type->tt_type == VAR_PARTIAL
|
|| type->tt_type == VAR_PARTIAL
|
||||||
|
|| type->tt_type == VAR_NUMBER // 1 means ignore case
|
||||||
|| type == &t_unknown
|
|| type == &t_unknown
|
||||||
|| type == &t_any)
|
|| type == &t_any)
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -934,9 +934,6 @@ endfunc
|
|||||||
|
|
||||||
" Tests for reverse(), sort(), uniq()
|
" Tests for reverse(), sort(), uniq()
|
||||||
func Test_reverse_sort_uniq()
|
func Test_reverse_sort_uniq()
|
||||||
func g:RetOne()
|
|
||||||
return 1
|
|
||||||
endfunc
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
VAR l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
|
VAR l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
|
||||||
call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l)))
|
call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l)))
|
||||||
@ -952,13 +949,12 @@ func Test_reverse_sort_uniq()
|
|||||||
call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
|
call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
|
||||||
|
|
||||||
LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
|
LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
|
||||||
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), g:RetOne()))
|
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 1))
|
||||||
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
|
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
|
||||||
call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
|
call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
|
||||||
endif
|
endif
|
||||||
END
|
END
|
||||||
call v9.CheckLegacyAndVim9Success(lines)
|
call v9.CheckLegacyAndVim9Success(lines)
|
||||||
delfunc g:RetOne
|
|
||||||
|
|
||||||
call assert_fails('call reverse("")', 'E899:')
|
call assert_fails('call reverse("")', 'E899:')
|
||||||
call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:')
|
call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:')
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
4451,
|
||||||
/**/
|
/**/
|
||||||
4450,
|
4450,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user