Patch 8.2.0307
Problem:    Python 3 vim.eval not well tested.
Solution:   Add a test. (Dominique Pelle, closes #5680)
Files:      src/testdir/test_python3.vim


*** ../vim-8.2.0306/src/testdir/test_python3.vim        2020-01-27 
22:09:35.792838636 +0100
--- src/testdir/test_python3.vim        2020-02-23 15:09:24.053570578 +0100
***************
*** 188,193 ****
--- 188,218 ----
    set encoding=utf8
  endfunc
  
+ " Test vim.eval() with various types.
+ func Test_python3_vim_val()
+   call assert_equal("\n8",             execute('py3 print(vim.eval("3+5"))'))
+   if has('float')
+     call assert_equal("\n3.140000",    execute('py3 
print(vim.eval("1.01+2.13"))'))
+     call assert_equal("\n0.000000",    execute('py3 
print(vim.eval("0.0/(1.0/0.0)"))'))
+     call assert_equal("\n0.000000",    execute('py3 
print(vim.eval("0.0/(1.0/0.0)"))'))
+     call assert_equal("\n-0.000000",   execute('py3 
print(vim.eval("0.0/(-1.0/0.0)"))'))
+     " Commented out: output of infinity and nan depend on platforms.
+     " call assert_equal("\ninf",         execute('py3 
print(vim.eval("1.0/0.0"))'))
+     " call assert_equal("\n-inf",        execute('py3 
print(vim.eval("-1.0/0.0"))'))
+     " call assert_equal("\n-nan",        execute('py3 
print(vim.eval("0.0/0.0"))'))
+   endif
+   call assert_equal("\nabc",           execute('py3 
print(vim.eval("\"abc\""))'))
+   call assert_equal("\n['1', '2']",    execute('py3 print(vim.eval("[1, 
2]"))'))
+   call assert_equal("\n{'1': '2'}",    execute('py3 
print(vim.eval("{1:2}"))'))
+   call assert_equal("\nTrue",          execute('py3 
print(vim.eval("v:true"))'))
+   call assert_equal("\nFalse",         execute('py3 
print(vim.eval("v:false"))'))
+   call assert_equal("\nNone",          execute('py3 
print(vim.eval("v:null"))'))
+   call assert_equal("\nNone",          execute('py3 
print(vim.eval("v:none"))'))
+   call assert_equal("\nb'\\xab\\x12'", execute('py3 
print(vim.eval("0zab12"))'))
+ 
+   call assert_fails('py3 vim.eval("1+")', 'vim.error: invalid expression')
+ endfunc
+ 
  " Test range objects, see :help python-range
  func Test_python3_range()
    new
*** ../vim-8.2.0306/src/version.c       2020-02-23 14:34:57.796437728 +0100
--- src/version.c       2020-02-23 15:09:39.733518150 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     307,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
104. When people ask about the Presidential Election you ask "Which country?"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202002231410.01NEAleJ023639%40masaka.moolenaar.net.

Raspunde prin e-mail lui