diff src/testdir/test_assert.vim @ 15904:fec4416adb80 v8.1.0958

patch 8.1.0958: compiling weird regexp pattern is very slow commit https://github.com/vim/vim/commit/38f08e76acf7d21bb34cf8f79f0f82eb63cdc987 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 20 22:04:32 2019 +0100 patch 8.1.0958: compiling weird regexp pattern is very slow Problem: Compiling weird regexp pattern is very slow. Solution: When reallocating post list increase size by 50%. (Kuang-che Wu, closes #4012) Make assert_inrange() accept float values.
author Bram Moolenaar <Bram@vim.org>
date Wed, 20 Feb 2019 22:15:05 +0100
parents e3ddffe48d17
children f38fcbf343ce
line wrap: on
line diff
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -190,6 +190,22 @@ func Test_assert_inrange()
   call remove(v:errors, 0)
 
   call assert_fails('call assert_inrange(1, 1)', 'E119:')
+
+  if has('float')
+    call assert_equal(0, assert_inrange(7.0, 7, 7))
+    call assert_equal(0, assert_inrange(7, 7.0, 7))
+    call assert_equal(0, assert_inrange(7, 7, 7.0))
+    call assert_equal(0, assert_inrange(5, 7, 5.0))
+    call assert_equal(0, assert_inrange(5, 7, 6.0))
+    call assert_equal(0, assert_inrange(5, 7, 7.0))
+
+    call assert_equal(1, assert_inrange(5, 7, 4.0))
+    call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0])
+    call remove(v:errors, 0)
+    call assert_equal(1, assert_inrange(5, 7, 8.0))
+    call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0])
+    call remove(v:errors, 0)
+  endif
 endfunc
 
 func Test_assert_with_msg()