On Tue, Aug 21, 2018 at 09:02:42PM -0400, James McCoy wrote:
> On Tue, Aug 21, 2018 at 08:29:09PM +0200, Bram Moolenaar wrote:
> > *** ../vim-8.1.0312/src/testdir/test_swap.vim       2018-05-12 
> > 15:57:33.000000000 +0200
> > --- src/testdir/test_swap.vim       2018-08-21 20:18:23.395917660 +0200
> > ***************
> > *** 97,99 ****
> > --- 97,133 ----
> >     set directory&
> >     call delete('Xswapdir', 'rf')
> >   endfunc
> > + 
> > + func Test_swapinfo()
> > +   new Xswapinfo
> > +   call setline(1, ['one', 'two', 'three'])
> > +   w
> > +   let fname = trim(execute('swapname'))
> > +   call assert_match('Xswapinfo', fname)
> > +   let info = swapinfo(fname)
> > +   call assert_match('8\.', info.version)
> 
> What about this patch so the test doesn't have to change whenever the
> version changes?
> 
> diff --git i/src/testdir/test_swap.vim w/src/testdir/test_swap.vim
> index c12693c81..d65960679 100644
> --- i/src/testdir/test_swap.vim
> +++ w/src/testdir/test_swap.vim
> @@ -105,7 +105,8 @@ func Test_swapinfo()
>    let fname = trim(execute('swapname'))
>    call assert_match('Xswapinfo', fname)
>    let info = swapinfo(fname)
> -  call assert_match('8\.', info.version)
> +  let ver = printf('VIM %d.%d', v:version / 100, v:version % 100)
> +  call assert_equal(ver, info.version)
>    call assert_match('\w', info.user)
>    call assert_equal(hostname(), info.host)
>    call assert_match('Xswapinfo', info.fname)
> 

Also, the test is currently failing on Travis[0] because b0_hname is
limited to B0_HNAME_SIZE bytes, including the NUL byte.

diff --git i/src/testdir/test_swap.vim w/src/testdir/test_swap.vim
index c12693c81..c296e6f08 100644
--- i/src/testdir/test_swap.vim
+++ w/src/testdir/test_swap.vim
@@ -107,7 +107,7 @@ func Test_swapinfo()
   let info = swapinfo(fname)
   call assert_match('8\.', info.version)
   call assert_match('\w', info.user)
-  call assert_equal(hostname(), info.host)
+  call assert_equal(hostname()[:38], info.host)
   call assert_match('Xswapinfo', info.fname)
   call assert_match(0, info.dirty)
   call assert_equal(getpid(), info.pid)

[0]: https://api.travis-ci.org/v3/job/418866411/log.txt

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

-- 
-- 
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