diff src/testdir/test_ruby.vim @ 15943:e5f82e8b3c06 v8.1.0977

patch 8.1.0977: blob not tested with Ruby commit https://github.com/vim/vim/commit/0d13cce3453b2274c93c5015faa1993baaebace9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 23 14:23:03 2019 +0100 patch 8.1.0977: blob not tested with Ruby Problem: Blob not tested with Ruby. Solution: Add more test coverage. fixes a crash. (Dominique Pelle, closes #4036)
author Bram Moolenaar <Bram@vim.org>
date Sat, 23 Feb 2019 14:30:11 +0100
parents e6ad77cf13e0
children 518f44125207
line wrap: on
line diff
--- a/src/testdir/test_ruby.vim
+++ b/src/testdir/test_ruby.vim
@@ -306,6 +306,9 @@ func Test_Vim_evaluate()
   call assert_equal('foo',      RubyEval('Vim::evaluate("\"foo\"")'))
   call assert_equal('String',   RubyEval('Vim::evaluate("\"foo\"").class'))
 
+  call assert_equal('["\x01\xAB"]', RubyEval('Vim::evaluate("0z01ab").unpack("M")'))
+  call assert_equal('String',       RubyEval('Vim::evaluate("0z01ab").class'))
+
   call assert_equal('[1, 2]',   RubyEval('Vim::evaluate("[1, 2]")'))
   call assert_equal('Array',    RubyEval('Vim::evaluate("[1, 2]").class'))
 
@@ -324,6 +327,13 @@ func Test_Vim_evaluate()
   call assert_equal('FalseClass',RubyEval('Vim::evaluate("v:false").class'))
 endfunc
 
+func Test_Vim_blob()
+  call assert_equal('0z',         RubyEval('Vim::blob("")'))
+  call assert_equal('0z31326162', RubyEval('Vim::blob("12ab")'))
+  call assert_equal('0z00010203', RubyEval('Vim::blob("\x00\x01\x02\x03")'))
+  call assert_equal('0z8081FEFF', RubyEval('Vim::blob("\x80\x81\xfe\xff")'))
+endfunc
+
 func Test_Vim_evaluate_list()
   call setline(line('$'), ['2 line 2'])
   ruby Vim.command("normal /^2\n")