Patch 8.1.0596
Problem:    Not all parts of printf() are tested.
Solution:   Add a few more test cases. (Dominique Pelle, closes #3691)
Files:      src/testdir/test_expr.vim


*** ../vim-8.1.0595/src/testdir/test_expr.vim   2018-03-03 14:56:04.000000000 
+0100
--- src/testdir/test_expr.vim   2018-12-15 16:06:32.419291794 +0100
***************
*** 142,147 ****
--- 142,163 ----
    call assert_equal('173', printf('%O', 123))
    call assert_equal('7b', printf('%x', 123))
    call assert_equal('7B', printf('%X', 123))
+ 
+   call assert_equal('123', printf('%hd', 123))
+   call assert_equal('-123', printf('%hd', -123))
+   call assert_equal('-1', printf('%hd', 0xFFFF))
+   call assert_equal('-1', printf('%hd', 0x1FFFFF))
+ 
+   call assert_equal('123', printf('%hu', 123))
+   call assert_equal('65413', printf('%hu', -123))
+   call assert_equal('65535', printf('%hu', 0xFFFF))
+   call assert_equal('65535', printf('%hu', 0x1FFFFF))
+ 
+   call assert_equal('123', printf('%ld', 123))
+   call assert_equal('-123', printf('%ld', -123))
+   call assert_equal('65535', printf('%ld', 0xFFFF))
+   call assert_equal('131071', printf('%ld', 0x1FFFF))
+ 
    if has('ebcdic')
      call assert_equal('#', printf('%c', 123))
    else
***************
*** 185,190 ****
--- 201,211 ----
    call assert_equal('  123', printf('% *d', 5, 123))
    call assert_equal(' +123', printf('%+ *d', 5, 123))
  
+   call assert_equal('foobar', printf('%.*s',  9, 'foobar'))
+   call assert_equal('foo',    printf('%.*s',  3, 'foobar'))
+   call assert_equal('',       printf('%.*s',  0, 'foobar'))
+   call assert_equal('foobar', printf('%.*s', -1, 'foobar'))
+ 
    " Simple quote (thousand grouping char) is ignored.
    call assert_equal('+00123456', printf("%+'09d", 123456))
  
***************
*** 207,212 ****
--- 228,238 ----
    call assert_equal(' 00123', printf('%6.5d', 123))
    call assert_equal(' 0007b', printf('%6.5x', 123))
  
+   call assert_equal('123', printf('%.2d', 123))
+   call assert_equal('0123', printf('%.4d', 123))
+   call assert_equal('0000000123', printf('%.10d', 123))
+   call assert_equal('123', printf('%.0d', 123))
+ 
    call assert_equal('abc', printf('%2s', 'abc'))
    call assert_equal('abc', printf('%2S', 'abc'))
    call assert_equal('abc', printf('%.4s', 'abc'))
***************
*** 305,310 ****
--- 331,341 ----
      call assert_equal('inf', printf('%s', 1.0/0.0))
      call assert_equal('-inf', printf('%s', -1.0/0.0))
  
+     " Test special case where max precision is truncated at 340.
+     call 
assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
 printf('%.330f', 1.0))
+     call 
assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
 printf('%.340f', 1.0))
+     call 
assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
 printf('%.350f', 1.0))
+ 
      " Float nan (not a number) has no sign.
      call assert_equal('nan', printf('%f', sqrt(-1.0)))
      call assert_equal('nan', printf('%f', 0.0/0.0))
*** ../vim-8.1.0595/src/version.c       2018-12-15 15:59:29.137676842 +0100
--- src/version.c       2018-12-15 16:07:31.030949891 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     596,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
15. Your heart races faster and beats irregularly each time you see a new WWW
    site address in print or on TV, even though you've never had heart
    problems before.

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui