diff src/testdir/test_sort.vim @ 19249:2a017e9dc6da v8.2.0183

patch 8.2.0183: tests fail when the float feature is disabled Commit: https://github.com/vim/vim/commit/5feabe00c47fa66d5f4c95213f150488433f78e3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 30 18:24:53 2020 +0100 patch 8.2.0183: tests fail when the float feature is disabled Problem: Tests fail when the float feature is disabled. Solution: Skip tests that don't work without float support.
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Jan 2020 18:30:04 +0100
parents b8fd7364befd
children 6fd567c927c0
line wrap: on
line diff
--- a/src/testdir/test_sort.vim
+++ b/src/testdir/test_sort.vim
@@ -1,5 +1,7 @@
 " Tests for the "sort()" function and for the ":sort" command.
 
+source check.vim
+
 func Compare1(a, b) abort
     call sort(range(3), 'Compare2')
     return a:a - a:b
@@ -28,6 +30,7 @@ func Test_sort_numbers()
 endfunc
 
 func Test_sort_float()
+  CheckFeature float
   call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f'))
 endfunc
 
@@ -37,6 +40,8 @@ func Test_sort_nested()
 endfunc
 
 func Test_sort_default()
+  CheckFeature float
+
   " docs say omitted, empty or zero argument sorts on string representation.
   call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"]))
   call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], ''))
@@ -1145,30 +1150,6 @@ func Test_sort_cmd()
 	\    ]
 	\ },
 	\ {
-	\    'name' : 'float',
-	\    'cmd' : 'sort f',
-	\    'input' : [
-	\	'1.234',
-	\	'0.88',
-	\	'  +  123.456',
-	\	'1.15e-6',
-	\	'-1.1e3',
-	\	'-1.01e3',
-	\	'',
-	\	''
-	\    ],
-	\    'expected' : [
-	\	'',
-	\	'',
-	\	'-1.1e3',
-	\	'-1.01e3',
-	\	'1.15e-6',
-	\	'0.88',
-	\	'1.234',
-	\	'  +  123.456'
-	\    ]
-	\ },
-	\ {
 	\    'name' : 'alphabetical, sorted input',
 	\    'cmd' : 'sort',
 	\    'input' : [
@@ -1223,6 +1204,35 @@ func Test_sort_cmd()
 	\ },
 	\ ]
 
+  if has('float')
+    let tests += [
+          \ {
+          \    'name' : 'float',
+          \    'cmd' : 'sort f',
+          \    'input' : [
+          \	'1.234',
+          \	'0.88',
+          \	'  +  123.456',
+          \	'1.15e-6',
+          \	'-1.1e3',
+          \	'-1.01e3',
+          \	'',
+          \	''
+          \    ],
+          \    'expected' : [
+          \	'',
+          \	'',
+          \	'-1.1e3',
+          \	'-1.01e3',
+          \	'1.15e-6',
+          \	'0.88',
+          \	'1.234',
+          \	'  +  123.456'
+          \    ]
+          \ },
+          \ ]
+  endif
+
   for t in tests
     enew!
     call append(0, t.input)