view src/testdir/test_sort.vim @ 7617:80bc36419c21 v7.4.1108

commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 16 21:50:51 2016 +0100 patch 7.4.1108 Problem: Expanding "~" halfway a file name. Solution: Handle the file name as one name. (Marco Hinz) Add a test. Closes https://github.com/vim/vim/issues/564.
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Jan 2016 22:00:05 +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