Patch 8.0.0359
Problem: 'number' and 'relativenumber' are not properly tested.
Solution: Add tests, change old style to new style tests. (Ozaki Kiichi,
closes #1447)
Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms,
src/testdir/test89.in, src/testdir/test89.ok,
src/testdir/test_alot.vim, src/testdir/test_findfile.vim,
src/testdir/test_number.vim
*** ../vim-8.0.0358/src/Makefile 2017-02-22 22:04:01.133026003 +0100
--- src/Makefile 2017-02-23 18:21:58.431729415 +0100
***************
*** 2082,2088 ****
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test60 test64 test65 test66 test67 test68 test69 \
test70 test72 test73 test74 test75 test77 test78 test79 \
! test80 test82 test83 test84 test85 test86 test87 test88 test89 \
test90 test91 test94 test95 test97 test98 test99 \
test100 test101 test103 test104 test107 test108:
cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected]
VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
--- 2082,2088 ----
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test60 test64 test65 test66 test67 test68 test69 \
test70 test72 test73 test74 test75 test77 test78 test79 \
! test80 test82 test83 test84 test85 test86 test87 test88 \
test90 test91 test94 test95 test97 test98 test99 \
test100 test101 test103 test104 test107 test108:
cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected]
VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
***************
*** 2122,2127 ****
--- 2122,2128 ----
test_fileformat \
test_filter_cmd \
test_filter_map \
+ test_findfile \
test_float_func \
test_fnameescape \
test_fnamemodify \
***************
*** 2164,2169 ****
--- 2165,2171 ----
test_nested_function \
test_netbeans \
test_normal \
+ test_number \
test_options \
test_packadd \
test_partial \
*** ../vim-8.0.0358/src/testdir/Make_all.mak 2017-02-17 12:04:35.843808317
+0100
--- src/testdir/Make_all.mak 2017-02-23 18:20:26.064325530 +0100
***************
*** 117,124 ****
test59.out \
test72.out \
test78.out \
! test83.out \
! test89.out
# Tests specifically for MS-Windows.
--- 117,123 ----
test59.out \
test72.out \
test78.out \
! test83.out
# Tests specifically for MS-Windows.
***************
*** 174,179 ****
--- 173,179 ----
test_nested_function.res \
test_netbeans.res \
test_normal.res \
+ test_number.res \
test_packadd.res \
test_paste.res \
test_perl.res \
*** ../vim-8.0.0358/src/testdir/Make_vms.mms 2016-12-01 18:47:06.595684409
+0100
--- src/testdir/Make_vms.mms 2017-02-23 18:20:26.068325504 +0100
***************
*** 91,97 ****
test66.out test67.out test68.out test69.out \
test72.out test75.out \
test77a.out test78.out test79.out test80.out \
! test82.out test84.out test88.out test89.out \
test90.out test91.out test94.out \
test95.out test98.out test99.out \
test103.out test104.out \
--- 91,97 ----
test66.out test67.out test68.out test69.out \
test72.out test75.out \
test77a.out test78.out test79.out test80.out \
! test82.out test84.out test88.out \
test90.out test91.out test94.out \
test95.out test98.out test99.out \
test103.out test104.out \
*** ../vim-8.0.0358/src/testdir/test89.in 2013-07-13 14:00:31.000000000
+0200
--- src/testdir/test89.in 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,71 ****
- - Some tests for setting 'number' and 'relativenumber'
- This is not all that useful now that the options are no longer reset when
- setting the other.
- - Some tests for findfile() function
-
- STARTTEST
- :so small.vim
- :set hidden nocp nu rnu viminfo+=nviminfo
- :redir @a | set nu? rnu? | redir END
- :e! xx
- :redir @b | set nu? rnu? | redir END
- :e! #
- :$put ='results:'
- :$put a
- :$put b
- :"
- :set nonu nornu
- :setglobal nu
- :setlocal rnu
- :redir @c | setglobal nu? | redir END
- :set nonu nornu
- :setglobal rnu
- :setlocal nu
- :redir @d | setglobal rnu? | redir END
- :$put =':setlocal must NOT reset the other global value'
- :$put c
- :$put d
- :"
- :set nonu nornu
- :setglobal nu
- :setglobal rnu
- :redir @e | setglobal nu? | redir END
- :set nonu nornu
- :setglobal rnu
- :setglobal nu
- :redir @f | setglobal rnu? | redir END
- :$put =':setglobal MUST reset the other global value'
- :$put e
- :$put f
- :"
- :set nonu nornu
- :set nu
- :set rnu
- :redir @g | setglobal nu? | redir END
- :set nonu nornu
- :set rnu
- :set nu
- :redir @h | setglobal rnu? | redir END
- :$put =':set MUST reset the other global value'
- :$put g
- :$put h
- :"
- :let cwd=getcwd()
- :cd ..
- :" Tests may be run from a shadow directory, so an extra cd needs to be done
to
- :" get above src/
- :if fnamemodify(getcwd(), ':t') != 'src' | cd ../.. | else | cd .. | endif
- :$put =''
- :$put ='Testing findfile'
- :$put =''
- :set ssl
- :$put =findfile('test19.in','src/test*')
- :exe "cd" cwd
- :cd ..
- :$put =findfile('test19.in','test*')
- :$put =findfile('test19.in','testdir')
- :exe "cd" cwd
- :/^results/,$w! test.out
- :q!
- ENDTEST
-
--- 0 ----
*** ../vim-8.0.0358/src/testdir/test89.ok 2013-07-03 17:06:20.000000000
+0200
--- src/testdir/test89.ok 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,28 ****
- results:
-
- number
- relativenumber
-
- number
- relativenumber
- :setlocal must NOT reset the other global value
-
- number
-
- relativenumber
- :setglobal MUST reset the other global value
-
- number
-
- relativenumber
- :set MUST reset the other global value
-
- number
-
- relativenumber
-
- Testing findfile
-
- src/testdir/test19.in
- testdir/test19.in
- testdir/test19.in
--- 0 ----
*** ../vim-8.0.0358/src/testdir/test_alot.vim 2017-02-18 16:58:44.264503901
+0100
--- src/testdir/test_alot.vim 2017-02-23 18:20:26.068325504 +0100
***************
*** 16,21 ****
--- 16,22 ----
source test_fileformat.vim
source test_filter_cmd.vim
source test_filter_map.vim
+ source test_findfile.vim
source test_float_func.vim
source test_fnamemodify.vim
source test_functions.vim
*** ../vim-8.0.0358/src/testdir/test_findfile.vim 2017-02-23
18:45:41.818563157 +0100
--- src/testdir/test_findfile.vim 2017-02-23 18:20:26.068325504 +0100
***************
*** 0 ****
--- 1,25 ----
+ " Test for findfile()
+ "
+ func Test_findfile()
+ new
+ let cwd=getcwd()
+ cd ..
+
+ " Tests may be run from a shadow directory, so an extra cd needs to be done
to
+ " get above src/
+ if fnamemodify(getcwd(), ':t') != 'src'
+ cd ../..
+ else
+ cd ..
+ endif
+ set ssl
+
+ call assert_equal('src/testdir/test_findfile.vim',
findfile('test_findfile.vim','src/test*'))
+ exe "cd" cwd
+ cd ..
+ call assert_equal('testdir/test_findfile.vim',
findfile('test_findfile.vim','test*'))
+ call assert_equal('testdir/test_findfile.vim',
findfile('test_findfile.vim','testdir'))
+
+ exe "cd" cwd
+ q!
+ endfunc
*** ../vim-8.0.0358/src/testdir/test_number.vim 2017-02-23 18:45:41.822563130
+0100
--- src/testdir/test_number.vim 2017-02-23 18:23:28.755146599 +0100
***************
*** 0 ****
--- 1,254 ----
+ " Test for 'number' and 'relativenumber'
+
+ source view_util.vim
+
+ func! s:screen_lines(start, end) abort
+ return ScreenLines([a:start, a:end], 8)
+ endfunc
+
+ func! s:compare_lines(expect, actual)
+ call assert_equal(a:expect, a:actual)
+ endfunc
+
+ func! s:test_windows(h, w) abort
+ call NewWindow(a:h, a:w)
+ endfunc
+
+ func! s:close_windows() abort
+ call CloseWindow()
+ endfunc
+
+ func! s:validate_cursor() abort
+ " update skipcol.
+ " wincol():
+ " f_wincol
+ " -> validate_cursor
+ " -> curs_columns
+ call wincol()
+ endfunc
+
+ func Test_set_options()
+ set nu rnu
+ call assert_equal(1, &nu)
+ call assert_equal(1, &rnu)
+
+ call s:test_windows(10, 20)
+ call assert_equal(1, &nu)
+ call assert_equal(1, &rnu)
+ call s:close_windows()
+
+ set nu& rnu&
+ endfunc
+
+ func Test_set_global_and_local()
+ " setlocal must NOT reset the other global value
+ set nonu nornu
+ setglobal nu
+ setlocal rnu
+ call assert_equal(1, &g:nu)
+
+ set nonu nornu
+ setglobal rnu
+ setlocal nu
+ call assert_equal(1, &g:rnu)
+
+ " setglobal MUST reset the other global value
+ set nonu nornu
+ setglobal nu
+ setglobal rnu
+ call assert_equal(1, &g:nu)
+
+ set nonu nornu
+ setglobal rnu
+ setglobal nu
+ call assert_equal(1, &g:rnu)
+
+ " set MUST reset the other global value
+ set nonu nornu
+ set nu
+ set rnu
+ call assert_equal(1, &g:nu)
+
+ set nonu nornu
+ set rnu
+ set nu
+ call assert_equal(1, &g:rnu)
+
+ set nu& rnu&
+ endfunc
+
+ func Test_number()
+ call s:test_windows(10, 20)
+ call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN",
"OPQRSTUVWX", "YZ"])
+ setl number
+ let lines = s:screen_lines(1, 4)
+ let expect = [
+ \ " 1 abcd",
+ \ " 2 klmn",
+ \ " 3 uvwx",
+ \ " 4 EFGH",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ func Test_relativenumber()
+ call s:test_windows(10, 20)
+ call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN",
"OPQRSTUVWX", "YZ"])
+ 3
+ setl relativenumber
+ let lines = s:screen_lines(1, 6)
+ let expect = [
+ \ " 2 abcd",
+ \ " 1 klmn",
+ \ " 0 uvwx",
+ \ " 1 EFGH",
+ \ " 2 OPQR",
+ \ " 3 YZ ",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ func Test_number_with_relativenumber()
+ call s:test_windows(10, 20)
+ call setline(1, ["abcdefghij", "klmnopqrst", "uvwxyzABCD", "EFGHIJKLMN",
"OPQRSTUVWX", "YZ"])
+ 4
+ setl number relativenumber
+ let lines = s:screen_lines(1, 6)
+ let expect = [
+ \ " 3 abcd",
+ \ " 2 klmn",
+ \ " 1 uvwx",
+ \ "4 EFGH",
+ \ " 1 OPQR",
+ \ " 2 YZ ",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ func Test_number_with_linewrap1()
+ call s:test_windows(3, 20)
+ normal! 61ia
+ setl number wrap
+ call s:validate_cursor()
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ "--1 aaaa",
+ \ " aaaa",
+ \ " aaaa",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ " Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
+ func XTest_number_with_linewrap2()
+ call s:test_windows(3, 20)
+ normal! 61ia
+ setl number wrap
+ call s:validate_cursor()
+ 0
+ call s:validate_cursor()
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ " 1 aaaa",
+ \ " aaaa",
+ \ " aaaa",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ " Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
+ func XTest_number_with_linewrap3()
+ call s:test_windows(4, 20)
+ normal! 81ia
+ setl number wrap
+ call s:validate_cursor()
+ setl nonumber
+ call s:validate_cursor()
+ let lines = s:screen_lines(1, 4)
+ let expect = [
+ \ "aaaaaaaa",
+ \ "aaaaaaaa",
+ \ "aaaaaaaa",
+ \ "a ",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ func Test_numberwidth()
+ call s:test_windows(10, 20)
+ call setline(1, repeat(['aaaa'], 10))
+ setl number numberwidth=6
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ " 1 aa",
+ \ " 2 aa",
+ \ " 3 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+
+ set relativenumber
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ "1 aa",
+ \ " 1 aa",
+ \ " 2 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+
+ set nonumber
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ " 0 aa",
+ \ " 1 aa",
+ \ " 2 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
+
+ func Test_numberwidth_adjusted()
+ call s:test_windows(10, 20)
+ call setline(1, repeat(['aaaa'], 10000))
+ setl number numberwidth=4
+ let lines = s:screen_lines(1, 3)
+ let expect = [
+ \ " 1 aa",
+ \ " 2 aa",
+ \ " 3 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+
+ $
+ let lines = s:screen_lines(8, 10)
+ let expect = [
+ \ " 9998 aa",
+ \ " 9999 aa",
+ \ "10000 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+
+ setl relativenumber
+ let lines = s:screen_lines(8, 10)
+ let expect = [
+ \ " 2 aa",
+ \ " 1 aa",
+ \ "10000 aa",
+ \ ]
+ call s:compare_lines(expect, lines)
+
+ setl nonumber
+ let lines = s:screen_lines(8, 10)
+ let expect = [
+ \ " 2 aaaa",
+ \ " 1 aaaa",
+ \ " 0 aaaa",
+ \ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+ endfunc
*** ../vim-8.0.0358/src/version.c 2017-02-23 18:08:51.328806464 +0100
--- src/version.c 2017-02-23 18:21:46.731804918 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 359,
/**/
--
hundred-and-one symptoms of being an internet addict:
11. You find yourself typing "com" after every period when using a word
processor.com
/// 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.