]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.1021: Ruby interface not tested enough v8.2.1021
authorBram Moolenaar <Bram@vim.org>
Sat, 20 Jun 2020 14:00:25 +0000 (16:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 20 Jun 2020 14:00:25 +0000 (16:00 +0200)
Problem:    Ruby interface not tested enough.
Solution:   Add a couple more tests. (Dominique PellĂ©, closes #6301)

src/testdir/test_ruby.vim
src/version.c

index eee2831acf11312873e4b21282be313ee4eb2ead..321ec4032a908efa43a837b8defadcad75cd2561 100644 (file)
@@ -26,6 +26,18 @@ func Test_rubydo()
   %bwipe!
 endfunc
 
+func Test_rubydo_dollar_underscore()
+  new
+  call setline(1, ['one', 'two', 'three', 'four'])
+  2,3rubydo $_ = '[' + $_  + ']'
+  call assert_equal(['one', '[two]', '[three]', 'four'], getline(1, '$'))
+  bwipe!
+
+  call assert_fails('rubydo $_ = 0', 'E265:')
+  call assert_fails('rubydo (')
+  bwipe!
+endfunc
+
 func Test_rubyfile()
   " Check :rubyfile does not SEGV with Ruby level exception but just fails
   let tempfile = tempname() . '.rb'
@@ -395,6 +407,15 @@ func Test_ruby_p()
   call assert_equal(0, len(messages))
 endfunc
 
+func Test_rubyeval_error()
+  " On Linux or Windows the error matches:
+  "   "syntax error, unexpected end-of-input"
+  " whereas on macOS in CI, the error message makes less sense:
+  "   "SyntaxError: array length must be 2"
+  " Unclear why. The test does not check the error message.
+  call assert_fails('call rubyeval("(")')
+endfunc
+
 " Test for various heredoc syntax
 func Test_ruby_heredoc()
   ruby << END
index b9e6d5bdadbc0e81270914eaa918ed49bffe22aa..94027af0f211d5e71713ca9c8f081baf43762983 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1021,
 /**/
     1020,
 /**/