view src/testdir/test_sort.vim @ 7376:88843d12c82b v7.4.993

commit https://github.com/vim/vim/commit/52f6ae1366b34fc5771595c0bd17c779a7f6f544 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 29 16:34:06 2015 +0100 patch 7.4.993 Problem: Test 87 is flaky on AppVeyor. Solution: Reduce the minimum background thread count.
author Christian Brabandt <cb@256bit.org>
date Tue, 29 Dec 2015 16:45:04 +0100
parents 6ffc75d807bd
children 20dc2763a3b9
line wrap: on
line source

" Test sort()

func Test_sort_strings()
  " numbers compared as strings
  call assert_equal([1, 2, 3], sort([3, 2, 1]))
  call assert_equal([13, 28, 3], sort([3, 28, 13]))
endfunc

func Test_sort_numeric()
  call assert_equal([1, 2, 3], sort([3, 2, 1], 'n'))
  call assert_equal([3, 13, 28], sort([13, 28, 3], 'n'))
  " strings are not sorted
  call assert_equal(['13', '28', '3'], sort(['13', '28', '3'], 'n'))
endfunc

func Test_sort_numbers()
  call assert_equal([3, 13, 28], sort([13, 28, 3], 'N'))
  call assert_equal(['3', '13', '28'], sort(['13', '28', '3'], 'N'))
endfunc