Compare commits

...

3 Commits

Author SHA1 Message Date
c43a8b8de0 patch 8.0.0369: a few options are not defined, depending on features
Problem:    The 'balloondelay', 'ballooneval' and 'balloonexpr' options are
            not defined without the +balloon_eval feature. Testing that an
            option value fails does not work for unsupported options.
Solution:   Make the options defined but not supported.  Don't test if
            setting unsupported options fails.
2017-02-25 21:12:29 +01:00
2f5463df01 patch 8.0.0368: not all options are tested with a range of values
Problem:    Not all options are tested with a range of values.
Solution:   Generate a test script from the source code.
2017-02-25 20:40:46 +01:00
f7506cade4 patch 8.0.0367: types in include files may be inconsistent
Problem:    If configure defines _LARGE_FILES some include files are included
            before it is defined.
Solution:   Include vim.h first. (Sam Thursfield, closes #1508)
2017-02-25 16:01:49 +01:00
11 changed files with 258 additions and 19 deletions

View File

@ -97,6 +97,7 @@ SRC_ALL = \
src/tee/tee.c \
src/xxd/xxd.c \
src/main.aap \
src/gen_opt_test.vim \
src/testdir/main.aap \
src/testdir/README.txt \
src/testdir/Make_all.mak \

View File

@ -2025,6 +2025,7 @@ test check: scripttests unittests
#
scripttests:
$(MAKE) -f Makefile $(VIMTARGET)
$(MAKE) -f Makefile testdir/opt_test.vim
if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
cd $(PODIR); $(MAKE) -f Makefile check VIM=../$(VIMTARGET); \
fi
@ -2033,6 +2034,8 @@ scripttests:
fi
cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
testdir/opt_test.vim: option.c gen_opt_test.vim
./$(VIMTARGET) -u gen_opt_test.vim --noplugin --not-a-term
# Run the tests with the GUI. Assumes vim/gvim was already built
testgui:
@ -2753,6 +2756,7 @@ clean celan: testclean
-rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c auto/gui_gtk_gresources.c auto/gui_gtk_gresources.h
-rm -f conftest* *~ auto/link.sed
-rm -f testdir/opt_test.vim
-rm -f $(UNITTEST_TARGETS)
-rm -f runtime pixmaps
-rm -rf $(APPDIR)
@ -2767,7 +2771,7 @@ SHADOWDIR = shadow
shadow: runtime pixmaps
mkdir $(SHADOWDIR)
cd $(SHADOWDIR); ln -s ../*.[chm] ../*.in ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs .
cd $(SHADOWDIR); ln -s ../*.[chm] ../*.in ../*.vim ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs .
mkdir $(SHADOWDIR)/auto
cd $(SHADOWDIR)/auto; ln -s ../../auto/configure .
mkdir $(SHADOWDIR)/po

194
src/gen_opt_test.vim Normal file
View File

@ -0,0 +1,194 @@
" Script to generate testdir/opt_test.vim from option.c
if 0
finish
endif
set cpo=&vim
set nomore
let script = [
\ 'let save_columns = &columns',
\ 'let save_lines = &lines',
\ 'let save_term = &term',
\ ]
edit option.c
/#define p_term
let end = line('.')
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
\ 'cmdheight': [[1, 2, 10], [-1, 0]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
\ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]],
\ 'helpheight': [[0, 10, 100], [-1]],
\ 'history': [[0, 1, 100], [-1, 10001]],
\ 'iminsert': [[0, 1], [-1, 3, 999]],
\ 'imsearch': [[-1, 0, 1], [-2, 3, 999]],
\ 'lines': [[2, 24], [-1, 0, 1]],
\ 'numberwidth': [[1, 4, 8, 10], [-1, 0, 11]],
\ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
\ 'report': [[0, 1, 2, 9999], [-1]],
\ 'scroll': [[0, 1, 2, 20], [-1]],
\ 'scrolljump': [[-50, -1, 0, 1, 2, 20], [999]],
\ 'scrolloff': [[0, 1, 2, 20], [-1]],
\ 'shiftwidth': [[0, 1, 8, 999], [-1]],
\ 'sidescroll': [[0, 1, 8, 999], [-1]],
\ 'sidescrolloff': [[0, 1, 8, 999], [-1]],
\ 'tabstop': [[1, 4, 8, 12], [-1, 0]],
\ 'textwidth': [[0, 1, 8, 99], [-1]],
\ 'timeoutlen': [[0, 8, 99999], [-1]],
\ 'titlelen': [[0, 1, 8, 9999], [-1]],
\ 'updatecount': [[0, 1, 8, 9999], [-1]],
\ 'updatetime': [[0, 1, 8, 9999], [-1]],
\ 'verbose': [[-1, 0, 1, 8, 9999], []],
\ 'winheight': [[1, 10, 999], [-1, 0]],
\ 'winminheight': [[0, 1], [-1]],
\ 'winminwidth': [[0, 1, 10], [-1]],
\ 'winwidth': [[1, 10, 999], [-1, 0]],
\
\ 'ambiwidth': [['', 'single'], ['xxx']],
\ 'background': [['', 'light', 'dark'], ['xxx']],
\ 'backspace': [[0, 2, '', 'eol', 'eol,start'], ['xxx']],
\ 'backupcopy': [['yes', 'auto'], ['', 'xxx', 'yes,no']],
\ 'backupext': [['xxx'], ['']],
\ 'belloff': [['', 'all', 'copy,error'], ['xxx']],
\ 'breakindentopt': [['', 'min:3', 'sbr'], ['xxx', 'min', 'min:x']],
\ 'browsedir': [['', 'last', '/tmp/'], ['xxx']],
\ 'bufhidden': [['', 'hide', 'wipe'], ['xxx', 'hide,wipe']],
\ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']],
\ 'casemap': [['', 'internal'], ['xxx']],
\ 'cedit': [['', '\<Esc>'], ['xxx', 'f']],
\ 'clipboard': [['', 'unnamed', 'autoselect,unnamed'], ['xxx']],
\ 'colorcolumn': [['', '8', '+2'], ['xxx']],
\ 'comments': [['', 'b:#'], ['xxx']],
\ 'commentstring': [['', '/*%s*/'], ['xxx']],
\ 'complete': [['', 'w,b'], ['xxx']],
\ 'concealcursor': [['', 'n', 'nvic'], ['xxx']],
\ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']],
\ 'cryptmethod': [['', 'zip'], ['xxx']],
\ 'cscopequickfix': [['', 's-', 's-,c+,e0'], ['xxx', 's,g,d']],
\ 'debug': [['', 'msg', 'msg', 'beep'], ['xxx']],
\ 'diffopt': [['', 'filler', 'icase,iwhite'], ['xxx']],
\ 'display': [['', 'lastline', 'lastline,uhex'], ['xxx']],
\ 'eadirection': [['', 'both', 'ver'], ['xxx', 'ver,hor']],
\ 'encoding': [['latin1'], ['xxx', '']],
\ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter'], ['xxx']],
\ 'fileencoding': [['', 'latin1', 'xxx'], []],
\ 'fileformat': [['', 'dos', 'unix'], ['xxx']],
\ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']],
\ 'fillchars': [['', 'vert:x'], ['xxx']],
\ 'foldclose': [['', 'all'], ['xxx']],
\ 'foldmethod': [['manual', 'indent'], ['', 'xxx', 'expr,diff']],
\ 'foldopen': [['', 'all', 'hor,jump'], ['xxx']],
\ 'foldmarker': [['((,))'], ['', 'xxx']],
\ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']],
\ 'guicursor': [['', 'n:block-Cursor'], ['xxx']],
\ 'helplang': [['', 'de', 'de,it'], ['xxx']],
\ 'highlight': [['', 'e:Error'], ['xxx']],
\ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']],
\ 'keymap': [['', 'accents'], ['xxx']],
\ 'keymodel': [['', 'startsel', 'startsel,stopsel'], ['xxx']],
\ 'langmap': [['', 'xX', 'aA,bB'], ['xxx']],
\ 'listchars': [['', 'eol:x', 'eol:x,space:y'], ['xxx']],
\ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']],
\ 'mkspellmem': [['10000,100,12'], ['', 'xxx']],
\ 'mouse': [['', 'a', 'nvi'], ['xxx', 'n,v,i']],
\ 'mousemodel': [['', 'popup'], ['xxx']],
\ 'mouseshape': [['', 'n:arrow'], ['xxx']],
\ 'nrformats': [['', 'alpha', 'alpha,hex,bin'], ['xxx']],
\ 'printmbfont': [['', 'r:some', 'b:Bold,c:yes'], ['xxx']],
\ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], ['xxx']],
\ 'scrollopt': [['', 'ver', 'ver,hor'], ['xxx']],
\ 'selection': [['old', 'inclusive'], ['', 'xxx']],
\ 'selectmode': [['', 'mouse', 'key,cmd'], ['xxx']],
\ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']],
\ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']],
\ 'spellfile': [['', 'file.en.add'], ['xxx', '/tmp/file']],
\ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']],
\ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']],
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
\ 'term': [['ansi'], ['', 'gui']],
\ 'toolbar': [['', 'icons', 'text'], ['xxx']],
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
\ 'ttymouse': [['', 'xterm'], ['xxx']],
\ 'ttytype': [['ansi'], ['', 'gui']],
\ 'viewoptions': [['', 'cursor', 'unix,slash'], ['xxx']],
\ 'viminfo': [['', '''50', '"30'], ['xxx']],
\ 'virtualedit': [['', 'all', 'all,block'], ['xxx']],
\ 'whichwrap': [['', 'b,s', 'bs'], ['xxx']],
\ 'wildmode': [['', 'full', 'list:full', 'full,longest'], ['xxx']],
\ 'wildoptions': [['', 'tagfile'], ['xxx']],
\ 'winaltkeys': [['menu', 'no'], ['', 'xxx']],
\
\ 'luadll': [[], []],
\ 'macatsui': [[], []],
\ 'perldll': [[], []],
\ 'pythondll': [[], []],
\ 'pythonthreedll': [[], []],
\ 'pyxversion': [[], []],
\ 'rubydll': [[], []],
\ 'tcldll': [[], []],
\
\ 'othernum': [[-1, 0, 100], []],
\ 'otherstring': [['', 'xxx'], []],
\}
1
/struct vimoption options
while 1
/{"
if line('.') > end
break
endif
let line = getline('.')
let name = substitute(line, '.*{"\([^"]*\)".*', '\1', '')
let shortname = substitute(line, '.*"\([^"]*\)".*', '\1', '')
if has_key(test_values, name)
let a = test_values[name]
elseif line =~ 'P_NUM'
let a = test_values['othernum']
else
let a = test_values['otherstring']
endif
if len(a[0]) > 0 || len(a[1]) > 0
if line =~ 'P_BOOL'
call add(script, 'set ' . name)
call add(script, 'set ' . shortname)
call add(script, 'set no' . name)
call add(script, 'set no' . shortname)
else
for val in a[0]
call add(script, 'set ' . name . '=' . val)
call add(script, 'set ' . shortname . '=' . val)
endfor
" setting an option can only fail when it's implemented.
call add(script, "if exists('+" . name . "')")
for val in a[1]
call add(script, "call assert_fails('set " . name . "=" . val . "')")
call add(script, "call assert_fails('set " . shortname . "=" . val . "')")
endfor
call add(script, "endif")
endif
call add(script, 'set ' . name . '&')
call add(script, 'set ' . shortname . '&')
endif
endwhile
call add(script, 'let &term = save_term')
call add(script, 'let &columns = save_columns')
call add(script, 'let &lines = save_lines')
call writefile(script, 'testdir/opt_test.vim')
qa!

View File

@ -60,11 +60,12 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* created by weissman, Mon Jul 7 13:20:03 1986 */
/* converted by swick, Thu Aug 27 1987 */
#include "vim.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/XawInit.h>
#include "vim.h"
#include "gui_at_sb.h"
#include <X11/Xmu/Drawing.h>

View File

@ -9,6 +9,8 @@
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#ifdef FEAT_GUI_NEXTAW
@ -34,7 +36,6 @@
# include <X11/Xaw/AsciiText.h>
#endif /* FEAT_GUI_NEXTAW */
#include "vim.h"
#ifndef FEAT_GUI_NEXTAW
# include "gui_at_sb.h"
#endif

View File

@ -8,6 +8,8 @@
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
#include <Xm/Form.h>
#include <Xm/RowColumn.h>
#include <Xm/PushB.h>
@ -33,8 +35,6 @@
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include "vim.h"
#ifdef HAVE_X11_XPM_H
# include <X11/xpm.h>
#else

View File

@ -12,6 +12,8 @@
* Not used for GTK.
*/
#include "vim.h"
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/StringDefs.h>
@ -19,8 +21,6 @@
#include <X11/Shell.h>
#include <X11/cursorfont.h>
#include "vim.h"
/*
* For Workshop XpmP.h is preferred, because it makes the signs drawn with a
* transparent background instead of black.

View File

@ -16,6 +16,8 @@
* when using a dynamic scrollbar policy.
*/
#include "vim.h"
#include <Xm/Form.h>
#include <Xm/PushBG.h>
#include <Xm/Text.h>
@ -36,8 +38,6 @@
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include "vim.h"
extern Widget vimShell;
#ifdef FEAT_MENU

View File

@ -624,19 +624,33 @@ static struct vimoption options[] =
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
#ifdef FEAT_BEVAL
{"balloondelay","bdlay",P_NUM|P_VI_DEF,
#ifdef FEAT_BEVAL
(char_u *)&p_bdlay, PV_NONE,
{(char_u *)600L, (char_u *)0L} SCRIPTID_INIT},
{"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
(char_u *)&p_beval, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
# ifdef FEAT_EVAL
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
(char_u *)&p_bexpr, PV_BEXPR,
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
# endif
{(char_u *)600L, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"ballooneval", "beval",P_BOOL|P_VI_DEF|P_NO_MKRC,
#ifdef FEAT_BEVAL
(char_u *)&p_beval, PV_NONE,
{(char_u *)FALSE, (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
(char_u *)&p_bexpr, PV_BEXPR,
{(char_u *)"", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"beautify", "bf", P_BOOL|P_VI_DEF,
(char_u *)NULL, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},

View File

@ -275,3 +275,21 @@ func Test_set_ttytype()
call assert_equal(&ttytype, &term)
endif
endfunc
func Test_set_all()
set tw=75
set iskeyword=a-z,A-Z
set nosplitbelow
let out = execute('set all')
call assert_match('textwidth=75', out)
call assert_match('iskeyword=a-z,A-Z', out)
call assert_match('nosplitbelow', out)
set tw& iskeyword& splitbelow&
endfunc
func Test_set_values()
" The file is only generated when running "make test" in the src directory.
if filereadable('opt_test.vim')
source opt_test.vim
endif
endfunc

View File

@ -764,6 +764,12 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
369,
/**/
368,
/**/
367,
/**/
366,
/**/