From 593df501b3a3687abb14a84299716bcd328b6ff8 Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 13 Dec 2015 12:19:54 +0900 Subject: vim-patch:7.4.944 Problem: Writing tests for Vim script is hard. Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add the v:errors variable. Add the runtest script. Add a first new style test script. https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801 --- src/nvim/eval.c | 86 ++++++++++++++++++++++++++++++++++- src/nvim/eval.h | 1 + src/nvim/garray.c | 5 +++ src/nvim/testdir/Makefile | 18 +++++++- src/nvim/testdir/runtest.vim | 97 ++++++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_assert.vim | 19 ++++++++ src/nvim/version.c | 2 +- 7 files changed, 224 insertions(+), 4 deletions(-) create mode 100644 src/nvim/testdir/runtest.vim create mode 100644 src/nvim/testdir/test_assert.vim (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 57d7002739..0bae48562a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -376,6 +376,7 @@ static struct vimvar { {VV_NAME("option_new", VAR_STRING), VV_RO}, {VV_NAME("option_old", VAR_STRING), VV_RO}, {VV_NAME("option_type", VAR_STRING), VV_RO}, + {VV_NAME("errors", VAR_LIST), 0}, {VV_NAME("msgpack_types", VAR_DICT), VV_RO}, }; @@ -7099,7 +7100,10 @@ static struct fst { {"argidx", 0, 0, f_argidx}, {"arglistid", 0, 2, f_arglistid}, {"argv", 0, 1, f_argv}, - {"asin", 1, 1, f_asin}, /* WJMc */ + {"asin", 1, 1, f_asin}, // WJMc + {"assertEqual", 2, 3, f_assertEqual}, + {"assertFalse", 1, 2, f_assertFalse}, + {"assertTrue", 1, 2, f_assertTrue}, {"atan", 1, 1, f_atan}, {"atan2", 2, 2, f_atan2}, {"browse", 4, 4, f_browse}, @@ -7981,6 +7985,86 @@ static void f_argv(typval_T *argvars, typval_T *rettv) } } +// Add an assert error to v:errors. +static void assertError(garray_T *gap) +{ + struct vimvar *vp = &vimvars[VV_ERRORS]; + + if (vp->vv_type != VAR_LIST || vimvars[VV_ERRORS].vv_list == NULL) { + // Make sure v:errors is a list. + set_vim_var_list(VV_ERRORS, list_alloc()); + } + list_append_string(vimvars[VV_ERRORS].vv_list, + gap->ga_data, gap->ga_len); +} + +static void prepareForAssertError(garray_T *gap) +{ + char buf[NUMBUFLEN]; + + ga_init(gap, 1, 100); + ga_concat(gap, sourcing_name); + vim_snprintf(buf, ARRAY_SIZE(buf), " line %ld", (long)sourcing_lnum); + ga_concat(gap, (char_u *)buf); +} + +// "assertEqual(expected, actual[, msg])" function +static void f_assertEqual(typval_T *argvars, typval_T *rettv) +{ + garray_T ga; + char_u *tofree; + + if (!tv_equal(&argvars[0], &argvars[1], false, false)) { + prepareForAssertError(&ga); + ga_concat(&ga, (char_u *)": Expected "); + tofree = (char_u *) tv2string(&argvars[0], NULL); + ga_concat(&ga, tofree); + xfree(tofree); + ga_concat(&ga, (char_u *)" but got "); + tofree = (char_u *) tv2string(&argvars[1], NULL); + ga_concat(&ga, tofree); + xfree(tofree); + assertError(&ga); + ga_clear(&ga); + } +} + +static void assertBool(typval_T *argvars, bool isTrue) +{ + int error = (int)false; + garray_T ga; + char_u *tofree; + + if (argvars[0].v_type != VAR_NUMBER || + (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) { + prepareForAssertError(&ga); + ga_concat(&ga, (char_u *)": Expected "); + if (isTrue) { + ga_concat(&ga, (char_u *)"True "); + } else { + ga_concat(&ga, (char_u *)"False "); + } + ga_concat(&ga, (char_u *)"but got "); + tofree = (char_u *) tv2string(&argvars[0], NULL); + ga_concat(&ga, tofree); + xfree(tofree); + assertError(&ga); + ga_clear(&ga); + } +} + +// "assertFalse(actual[, msg])" function +static void f_assertFalse(typval_T *argvars, typval_T *rettv) +{ + assertBool(argvars, false); +} + +// "assertTrue(actual[, msg])" function +static void f_assertTrue(typval_T *argvars, typval_T *rettv) +{ + assertBool(argvars, true); +} + /* * "asin()" function */ diff --git a/src/nvim/eval.h b/src/nvim/eval.h index ea8b5bc253..79a1341d98 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -111,6 +111,7 @@ enum { VV_OPTION_NEW, VV_OPTION_OLD, VV_OPTION_TYPE, + VV_ERRORS, VV_MSGPACK_TYPES, VV_LEN, /* number of v: vars */ }; diff --git a/src/nvim/garray.c b/src/nvim/garray.c index 75c3fb9a73..e6cbd9332b 100644 --- a/src/nvim/garray.c +++ b/src/nvim/garray.c @@ -174,6 +174,7 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET } /// Concatenate a string to a growarray which contains characters. +/// When "s" is NULL does not do anything. /// /// WARNING: /// - Does NOT copy the NUL at the end! @@ -183,6 +184,10 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET /// @param s void ga_concat(garray_T *gap, const char_u *restrict s) { + if (s == NULL) { + return; + } + int len = (int)strlen((char *) s); if (len) { ga_grow(gap, len); diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 1a414a8847..57d356705e 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -31,6 +31,8 @@ SCRIPTS := test_eval.out \ test_command_count.out \ test_cdo.out \ +NEW_TESTS = test_assert.res + SCRIPTS_GUI := test16.out @@ -62,9 +64,9 @@ ifdef TESTNUM SCRIPTS := test$(TESTNUM).out endif -nongui: nolog $(SCRIPTS) report +nongui: nolog $(SCRIPTS) newtests report -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) newtests report .gdbinit: echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit @@ -91,6 +93,7 @@ RUN_VIM := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(VIMPROG) clean: -rm -rf *.out \ *.failed \ + *.res \ *.rej \ *.orig \ test.log \ @@ -147,3 +150,14 @@ test49.out: test49.vim nolog: -rm -f test.log + + +# New style of tests uses Vim script with assert calls. These are easier +# to write and a lot easier to read and debug. +# Limitation: Only works with the +eval feature. +RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin + +newtests: $(NEW_TESTS) + +%.res: %.vim .gdbinit + $(RUN_VIMTEST) -u runtest.vim $*.vim diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim new file mode 100644 index 0000000000..8589bf6935 --- /dev/null +++ b/src/nvim/testdir/runtest.vim @@ -0,0 +1,97 @@ +" This script is sourced while editing the .vim file with the tests. +" When the script is successful the .res file will be created. +" Errors are appended to the test.log file. +" +" The test script may contain anything, only functions that start with +" "Test_" are special. These will be invoked and should contain assert +" functions. See test_assert.vim for an example. +" +" It is possible to source other files that contain "Test_" functions. This +" can speed up testing, since Vim does not need to restart. But be careful +" that the tests do not interfere with each other. +" +" If an error cannot be detected properly with an assert function add the +" error to the v:errors list: +" call add(v:errors, 'test foo failed: Cannot find xyz') +" +" If preparation for each Test_ function is needed, define a SetUp function. +" It will be called before each Test_ function. +" +" If cleanup after each Test_ function is needed, define a TearDown function. +" It will be called after each Test_ function. + +" Without the +eval feature we can't run these tests, bail out. +if 0 + quit! +endif + +" Check that the screen size is at least 24 x 80 characters. +if &lines < 24 || &columns < 80 + let error = 'Screen size too small! Tests require at least 24 lines with 80 characters' + echoerr error + split test.log + $put =error + w + cquit +endif + +" Source the test script. First grab the file name, in case the script +" navigates away. +let testname = expand('%') +source % + +" Locate Test_ functions and execute them. +redir @q +function /^Test_ +redir END +let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) + +let done = 0 +let fail = 0 +let errors = [] +for test in tests + if exists("*SetUp") + call SetUp() + endif + + let done += 1 + try + exe 'call ' . test + catch + let fail += 1 + call add(v:errors, 'Caught exception in ' . test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry + + if len(v:errors) > 0 + let fail += 1 + call add(errors, 'Found errors in ' . test . ':') + call extend(errors, v:errors) + let v:errors = [] + endif + + if exists("*TearDown") + call TearDown() + endif +endfor + +if fail == 0 + " Success, create the .res file so that make knows it's done. + split %:r.res + write +endif + +if len(errors) > 0 + " Append errors to test.log + split test.log + call append(line('$'), '') + call append(line('$'), 'From ' . testname . ':') + call append(line('$'), errors) + write +endif + +echo 'Executed ' . done . (done > 1 ? ' tests': ' test') +if fail > 0 + echo fail . ' FAILED' +endif + +qall! diff --git a/src/nvim/testdir/test_assert.vim b/src/nvim/testdir/test_assert.vim new file mode 100644 index 0000000000..049ce98859 --- /dev/null +++ b/src/nvim/testdir/test_assert.vim @@ -0,0 +1,19 @@ +" Test that the methods used for testing work. + +func Test_assert_false() + call assert_false(0) +endfunc + +func Test_assert_true() + call assert_true(1) + call assert_true(123) +endfunc + +func Test_assert_equal() + let s = 'foo' + call assert_equal('foo', s) + let n = 4 + call assert_equal(4, n) + let l = [1, 2, 3] + call assert_equal([1, 2, 3], l) +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index 6919efe871..e1b16d099b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -125,7 +125,7 @@ static int included_patches[] = { // 947, // 946, // 945, - // 944, + 944, // 943, // 942, // 941, -- cgit From 008c014cbe0fd4862dd989287aca1050d2ed89b1 Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 13 Dec 2015 20:15:48 +0900 Subject: vim-patch:7.4.945 Problem: New style testing is incomplete. Solution: Add the runtest script to the list of distributed files. Add the new functions to the function overview. Rename the functions to match Vim function style. Move undolevels testing into a new style test script. https://github.com/vim/vim/commit/683fa185a4b4ed7595e5942901548b8239ed5cdb --- src/nvim/testdir/Makefile | 3 ++- src/nvim/testdir/test_undolevels.vim | 46 ++++++++++++++++++++++++++++++++++++ src/nvim/version.c | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/nvim/testdir/test_undolevels.vim (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 57d356705e..23a9b97d91 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -31,7 +31,8 @@ SCRIPTS := test_eval.out \ test_command_count.out \ test_cdo.out \ -NEW_TESTS = test_assert.res +NEW_TESTS = test_assert.res \ + test_undolevels.res SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_undolevels.vim b/src/nvim/testdir/test_undolevels.vim new file mode 100644 index 0000000000..427cece24c --- /dev/null +++ b/src/nvim/testdir/test_undolevels.vim @@ -0,0 +1,46 @@ +" Tests for 'undolevels' + +set nocompatible viminfo+=nviminfo + +func FillBuffer() + for i in range(1,13) + put=i + " Set 'undolevels' to split undo. + exe "setg ul=" . &g:ul + endfor +endfunc + +func Test_global_local_undolevels() + new one + set undolevels=5 + call FillBuffer() + " will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines + earlier 10 + call assert_equal(5, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + call assert_equal('7', getline('$')) + + new two + setlocal undolevels=2 + call FillBuffer() + " will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines + earlier 10 + call assert_equal(5, &g:undolevels) + call assert_equal(2, &l:undolevels) + call assert_equal('10', getline('$')) + + setlocal ul=10 + call assert_equal(5, &g:undolevels) + call assert_equal(10, &l:undolevels) + + " Setting local value in "two" must not change local value in "one" + wincmd p + call assert_equal(5, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + + new three + setglobal ul=50 + call assert_equal(50, &g:undolevels) + call assert_equal(-123456, &l:undolevels) + +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index e1b16d099b..45f3c39466 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -124,7 +124,7 @@ static int included_patches[] = { // 948 NA // 947, // 946, - // 945, + 945, 944, // 943, // 942, -- cgit From 588b09277bb003f51b0f5c8ba5eef4ddd6239209 Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 13 Dec 2015 21:31:34 +0900 Subject: vim-patch:7.4.946 Problem: Missing changes in source file. Solution: Include changes to the eval.c file. https://github.com/vim/vim/commit/bbfbaf9741deebb9f1ed790885bd571c4cbce17a --- src/nvim/eval.c | 109 ++++++++++++++++++++++++++++++----------------------- src/nvim/version.c | 2 +- 2 files changed, 63 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 0bae48562a..d5a4765f92 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7101,9 +7101,9 @@ static struct fst { {"arglistid", 0, 2, f_arglistid}, {"argv", 0, 1, f_argv}, {"asin", 1, 1, f_asin}, // WJMc - {"assertEqual", 2, 3, f_assertEqual}, - {"assertFalse", 1, 2, f_assertFalse}, - {"assertTrue", 1, 2, f_assertTrue}, + {"assert_equal", 2, 3, f_assert_equal}, + {"assert_false", 1, 2, f_assert_false}, + {"assert_true", 1, 2, f_assert_true}, {"atan", 1, 1, f_atan}, {"atan2", 2, 2, f_atan2}, {"browse", 4, 4, f_browse}, @@ -7985,8 +7985,47 @@ static void f_argv(typval_T *argvars, typval_T *rettv) } } +// Prepare "gap" for an assert error and add the sourcing position. +static void prepare_assert_error(garray_T *gap) +{ + char buf[NUMBUFLEN]; + + ga_init(gap, 1, 100); + ga_concat(gap, sourcing_name); + vim_snprintf(buf, ARRAY_SIZE(buf), " line %ld", (long)sourcing_lnum); + ga_concat(gap, (char_u *)buf); + ga_concat(gap, (char_u *)": "); +} + +// Fill "gap" with information about an assert error. +static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, + char_u *exp_str, typval_T *exp_tv, + typval_T *got_tv) +{ + char_u *tofree; + + if (opt_msg_tv->v_type != VAR_UNKNOWN) { + tofree = (char_u *) tv2string(opt_msg_tv, NULL); + ga_concat(gap, tofree); + xfree(tofree); + } else { + ga_concat(gap, (char_u *)"Expected "); + if (exp_str == NULL) { + tofree = (char_u *) tv2string(exp_tv, NULL); + ga_concat(gap, tofree); + xfree(tofree); + } else { + ga_concat(gap, exp_str); + } + tofree = (char_u *) tv2string(got_tv, NULL); + ga_concat(gap, (char_u *)" but got "); + ga_concat(gap, tofree); + xfree(tofree); + } +} + // Add an assert error to v:errors. -static void assertError(garray_T *gap) +static void assert_error(garray_T *gap) { struct vimvar *vp = &vimvars[VV_ERRORS]; @@ -7998,71 +8037,47 @@ static void assertError(garray_T *gap) gap->ga_data, gap->ga_len); } -static void prepareForAssertError(garray_T *gap) -{ - char buf[NUMBUFLEN]; - - ga_init(gap, 1, 100); - ga_concat(gap, sourcing_name); - vim_snprintf(buf, ARRAY_SIZE(buf), " line %ld", (long)sourcing_lnum); - ga_concat(gap, (char_u *)buf); -} - -// "assertEqual(expected, actual[, msg])" function -static void f_assertEqual(typval_T *argvars, typval_T *rettv) +// "assert_equal(expected, actual[, msg])" function +static void f_assert_equal(typval_T *argvars, typval_T *rettv) { garray_T ga; - char_u *tofree; if (!tv_equal(&argvars[0], &argvars[1], false, false)) { - prepareForAssertError(&ga); - ga_concat(&ga, (char_u *)": Expected "); - tofree = (char_u *) tv2string(&argvars[0], NULL); - ga_concat(&ga, tofree); - xfree(tofree); - ga_concat(&ga, (char_u *)" but got "); - tofree = (char_u *) tv2string(&argvars[1], NULL); - ga_concat(&ga, tofree); - xfree(tofree); - assertError(&ga); + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[2], NULL, + &argvars[0], &argvars[1]); + assert_error(&ga); ga_clear(&ga); } } -static void assertBool(typval_T *argvars, bool isTrue) +// Common for assert_true() and assert_false(). +static void assert_bool(typval_T *argvars, bool isTrue) { int error = (int)false; garray_T ga; - char_u *tofree; if (argvars[0].v_type != VAR_NUMBER || (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) { - prepareForAssertError(&ga); - ga_concat(&ga, (char_u *)": Expected "); - if (isTrue) { - ga_concat(&ga, (char_u *)"True "); - } else { - ga_concat(&ga, (char_u *)"False "); - } - ga_concat(&ga, (char_u *)"but got "); - tofree = (char_u *) tv2string(&argvars[0], NULL); - ga_concat(&ga, tofree); - xfree(tofree); - assertError(&ga); + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[1], + (char_u *)(isTrue ? "True " : "False "), + NULL, &argvars[0]); + assert_error(&ga); ga_clear(&ga); } } -// "assertFalse(actual[, msg])" function -static void f_assertFalse(typval_T *argvars, typval_T *rettv) +// "assert_false(actual[, msg])" function +static void f_assert_false(typval_T *argvars, typval_T *rettv) { - assertBool(argvars, false); + assert_bool(argvars, false); } -// "assertTrue(actual[, msg])" function -static void f_assertTrue(typval_T *argvars, typval_T *rettv) +// "assert_true(actual[, msg])" function +static void f_assert_true(typval_T *argvars, typval_T *rettv) { - assertBool(argvars, true); + assert_bool(argvars, true); } /* diff --git a/src/nvim/version.c b/src/nvim/version.c index 45f3c39466..4ea9c5bda3 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -123,7 +123,7 @@ static int included_patches[] = { // 949, // 948 NA // 947, - // 946, + 946, 945, 944, // 943, -- cgit From 47fac915f3a994f11cf94f1ada47b50e078615fc Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 13 Dec 2015 22:27:35 +0900 Subject: vim-patch:7.4.950 Problem: v:errors is not initialized. Solution: Initialze it to an empty list. (Thinca) https://github.com/vim/vim/commit/4649ded2877508fe343cbcf6f7e7fd277be0aab3 --- src/nvim/eval.c | 1 + src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d5a4765f92..22d3e7c91a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -545,6 +545,7 @@ void eval_init(void) set_vim_var_dict(VV_MSGPACK_TYPES, msgpack_types_dict); set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc()); + set_vim_var_list(VV_ERRORS, list_alloc()); set_vim_var_nr(VV_SEARCHFORWARD, 1L); set_vim_var_nr(VV_HLSEARCH, 1L); set_reg_var(0); /* default for v:register is not 0 but '"' */ diff --git a/src/nvim/version.c b/src/nvim/version.c index 4ea9c5bda3..3f87517f47 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -119,7 +119,7 @@ static int included_patches[] = { // 953, // 952, // 951, - // 950, + 950, // 949, // 948 NA // 947, -- cgit From 2586459118ca589c8393121a5d3696802ed1a606 Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 13 Dec 2015 22:40:23 +0900 Subject: vim-patch:7.4.953 Problem: When a test script navigates to another buffer the .res file is created with the wrong name. Solution: Use the "testname" for the .res file. (Damien) https://github.com/vim/vim/commit/de0ad40cb3c1bc691a754698ed16a5b6cdb4086b --- src/nvim/testdir/runtest.vim | 2 +- src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 8589bf6935..0dc142eb97 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -76,7 +76,7 @@ endfor if fail == 0 " Success, create the .res file so that make knows it's done. - split %:r.res + exe 'split ' . fnamemodify(testname, ':r') . '.res' write endif diff --git a/src/nvim/version.c b/src/nvim/version.c index 3f87517f47..4ba901cc0f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -116,7 +116,7 @@ static int included_patches[] = { // 956, // 955, // 954 NA - // 953, + 953, // 952, // 951, 950, -- cgit From 3a6cef9ee6de3ae577114a56343a9e336f900eac Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 17 Dec 2015 17:08:23 +0900 Subject: vim-patch:7.4.1032 Problem: message from assert_false() does not look nice. Solution: Handle missing sourcing_name. Use right number of spaces. (Watiko) Don't use line number if it's zero. https://github.com/vim/vim/commit/cbfe32953aea09d35d9ac7e5865c915b14e310c1 --- src/nvim/eval.c | 19 ++++++++++++++----- src/nvim/version.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 22d3e7c91a..59b8d817cd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7992,10 +7992,19 @@ static void prepare_assert_error(garray_T *gap) char buf[NUMBUFLEN]; ga_init(gap, 1, 100); - ga_concat(gap, sourcing_name); - vim_snprintf(buf, ARRAY_SIZE(buf), " line %ld", (long)sourcing_lnum); - ga_concat(gap, (char_u *)buf); - ga_concat(gap, (char_u *)": "); + if (sourcing_name != NULL) { + ga_concat(gap, sourcing_name); + if (sourcing_lnum > 0) { + ga_concat(gap, (char_u *)" "); + } + } + if (sourcing_lnum > 0) { + vim_snprintf(buf, ARRAY_SIZE(buf), "line %ld", (long)sourcing_lnum); + ga_concat(gap, (char_u *)buf); + } + if (sourcing_name != NULL || sourcing_lnum > 0) { + ga_concat(gap, (char_u *)": "); + } } // Fill "gap" with information about an assert error. @@ -8062,7 +8071,7 @@ static void assert_bool(typval_T *argvars, bool isTrue) (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) { prepare_assert_error(&ga); fill_assert_error(&ga, &argvars[1], - (char_u *)(isTrue ? "True " : "False "), + (char_u *)(isTrue ? "True" : "False"), NULL, &argvars[0]); assert_error(&ga); ga_clear(&ga); diff --git a/src/nvim/version.c b/src/nvim/version.c index 4ba901cc0f..b6f4f2f5bb 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -69,6 +69,38 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 1032, + // 1031, + // 1030, + // 1029, + // 1028, + // 1027, + // 1026, + // 1025, + // 1024, + // 1023, + // 1022, + // 1021, + // 1020, + // 1019, + // 1018, + // 1017, + // 1016, + // 1015, + // 1014, + // 1013, + // 1012, + // 1011, + // 1010, + // 1009, + // 1008, + // 1007, + // 1006, + // 1005, + // 1004, + // 1003, + // 1002, + // 1001, // 1000, // 999 NA // 998, -- cgit From 6c8e572d098457868c9090fa562d9628c6537849 Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 10 Jan 2016 09:10:17 +0900 Subject: vim-patch:7.4.1055 Problem: Running "make newtests" in src/testdir has no output. Solution: List the messages file when a test fails. (Christian Brabandt) Update the list of tests. https://github.com/vim/vim/commit/e7893a4088d6ea796bcab6195d232cb26c12c317 --- src/nvim/testdir/Makefile | 7 ++++++- src/nvim/version.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 23a9b97d91..efcb8a68d2 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -158,7 +158,12 @@ nolog: # Limitation: Only works with the +eval feature. RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -newtests: $(NEW_TESTS) +newtests: newtestssilent + @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \ + cat messages && cat test.log; \ + fi" \ + +newtestssilent: $(NEW_TESTS) %.res: %.vim .gdbinit $(RUN_VIMTEST) -u runtest.vim $*.vim diff --git a/src/nvim/version.c b/src/nvim/version.c index b6f4f2f5bb..d0a2771a19 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -69,6 +69,29 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 1055, + // 1054, + // 1053, + // 1052, + // 1051, + // 1050, + // 1049, + // 1048, + // 1047, + // 1046, + // 1045, + // 1044, + // 1043, + // 1042, + // 1041, + // 1040, + // 1039, + // 1038, + // 1037, + // 1036, + // 1035, + // 1034, + // 1033, 1032, // 1031, // 1030, -- cgit From d8e07deff6e3763166259f04c57b8f253bb2db46 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 17 Dec 2015 17:22:19 +0900 Subject: tests: Migrate legacy test assert. --- src/nvim/testdir/Makefile | 3 +-- src/nvim/testdir/test_assert.vim | 19 ------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 src/nvim/testdir/test_assert.vim (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index efcb8a68d2..381d1727da 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -31,8 +31,7 @@ SCRIPTS := test_eval.out \ test_command_count.out \ test_cdo.out \ -NEW_TESTS = test_assert.res \ - test_undolevels.res +NEW_TESTS = test_undolevels.res SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_assert.vim b/src/nvim/testdir/test_assert.vim deleted file mode 100644 index 049ce98859..0000000000 --- a/src/nvim/testdir/test_assert.vim +++ /dev/null @@ -1,19 +0,0 @@ -" Test that the methods used for testing work. - -func Test_assert_false() - call assert_false(0) -endfunc - -func Test_assert_true() - call assert_true(1) - call assert_true(123) -endfunc - -func Test_assert_equal() - let s = 'foo' - call assert_equal('foo', s) - let n = 4 - call assert_equal(4, n) - let l = [1, 2, 3] - call assert_equal([1, 2, 3], l) -endfunc -- cgit From 9c5ab23ef2e0adf45b09d9f0586e5c914db9658f Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 17 Dec 2015 17:55:34 +0900 Subject: tests: Migrate legacy test undolevels. --- src/nvim/testdir/Makefile | 2 +- src/nvim/testdir/test_undolevels.vim | 46 ------------------------------------ 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 src/nvim/testdir/test_undolevels.vim (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 381d1727da..b4292dbd4b 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -31,7 +31,7 @@ SCRIPTS := test_eval.out \ test_command_count.out \ test_cdo.out \ -NEW_TESTS = test_undolevels.res +NEW_TESTS = SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_undolevels.vim b/src/nvim/testdir/test_undolevels.vim deleted file mode 100644 index 427cece24c..0000000000 --- a/src/nvim/testdir/test_undolevels.vim +++ /dev/null @@ -1,46 +0,0 @@ -" Tests for 'undolevels' - -set nocompatible viminfo+=nviminfo - -func FillBuffer() - for i in range(1,13) - put=i - " Set 'undolevels' to split undo. - exe "setg ul=" . &g:ul - endfor -endfunc - -func Test_global_local_undolevels() - new one - set undolevels=5 - call FillBuffer() - " will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines - earlier 10 - call assert_equal(5, &g:undolevels) - call assert_equal(-123456, &l:undolevels) - call assert_equal('7', getline('$')) - - new two - setlocal undolevels=2 - call FillBuffer() - " will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines - earlier 10 - call assert_equal(5, &g:undolevels) - call assert_equal(2, &l:undolevels) - call assert_equal('10', getline('$')) - - setlocal ul=10 - call assert_equal(5, &g:undolevels) - call assert_equal(10, &l:undolevels) - - " Setting local value in "two" must not change local value in "one" - wincmd p - call assert_equal(5, &g:undolevels) - call assert_equal(-123456, &l:undolevels) - - new three - setglobal ul=50 - call assert_equal(50, &g:undolevels) - call assert_equal(-123456, &l:undolevels) - -endfunc -- cgit From f350655ddd3846f7c1e12a21fcb30d49f90fa6b6 Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 19 Dec 2015 12:33:09 +0900 Subject: Improve coding style --- src/nvim/eval.c | 714 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 357 insertions(+), 357 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 59b8d817cd..76708e21ad 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -313,71 +313,71 @@ static struct vimvar { * The order here must match the VV_ defines in eval.h! * Initializing a union does not work, leave tv.vval empty to get zero's. */ - {VV_NAME("count", VAR_NUMBER), VV_COMPAT+VV_RO}, - {VV_NAME("count1", VAR_NUMBER), VV_RO}, - {VV_NAME("prevcount", VAR_NUMBER), VV_RO}, - {VV_NAME("errmsg", VAR_STRING), VV_COMPAT}, - {VV_NAME("warningmsg", VAR_STRING), 0}, - {VV_NAME("statusmsg", VAR_STRING), 0}, - {VV_NAME("shell_error", VAR_NUMBER), VV_COMPAT+VV_RO}, - {VV_NAME("this_session", VAR_STRING), VV_COMPAT}, - {VV_NAME("version", VAR_NUMBER), VV_COMPAT+VV_RO}, - {VV_NAME("lnum", VAR_NUMBER), VV_RO_SBX}, - {VV_NAME("termresponse", VAR_STRING), VV_RO}, - {VV_NAME("fname", VAR_STRING), VV_RO}, - {VV_NAME("lang", VAR_STRING), VV_RO}, - {VV_NAME("lc_time", VAR_STRING), VV_RO}, - {VV_NAME("ctype", VAR_STRING), VV_RO}, - {VV_NAME("charconvert_from", VAR_STRING), VV_RO}, - {VV_NAME("charconvert_to", VAR_STRING), VV_RO}, - {VV_NAME("fname_in", VAR_STRING), VV_RO}, - {VV_NAME("fname_out", VAR_STRING), VV_RO}, - {VV_NAME("fname_new", VAR_STRING), VV_RO}, - {VV_NAME("fname_diff", VAR_STRING), VV_RO}, - {VV_NAME("cmdarg", VAR_STRING), VV_RO}, - {VV_NAME("foldstart", VAR_NUMBER), VV_RO_SBX}, - {VV_NAME("foldend", VAR_NUMBER), VV_RO_SBX}, - {VV_NAME("folddashes", VAR_STRING), VV_RO_SBX}, - {VV_NAME("foldlevel", VAR_NUMBER), VV_RO_SBX}, - {VV_NAME("progname", VAR_STRING), VV_RO}, - {VV_NAME("servername", VAR_STRING), VV_RO}, - {VV_NAME("dying", VAR_NUMBER), VV_RO}, - {VV_NAME("exception", VAR_STRING), VV_RO}, - {VV_NAME("throwpoint", VAR_STRING), VV_RO}, - {VV_NAME("register", VAR_STRING), VV_RO}, - {VV_NAME("cmdbang", VAR_NUMBER), VV_RO}, - {VV_NAME("insertmode", VAR_STRING), VV_RO}, - {VV_NAME("val", VAR_UNKNOWN), VV_RO}, - {VV_NAME("key", VAR_UNKNOWN), VV_RO}, - {VV_NAME("profiling", VAR_NUMBER), VV_RO}, - {VV_NAME("fcs_reason", VAR_STRING), VV_RO}, - {VV_NAME("fcs_choice", VAR_STRING), 0}, - {VV_NAME("beval_bufnr", VAR_NUMBER), VV_RO}, - {VV_NAME("beval_winnr", VAR_NUMBER), VV_RO}, - {VV_NAME("beval_lnum", VAR_NUMBER), VV_RO}, - {VV_NAME("beval_col", VAR_NUMBER), VV_RO}, - {VV_NAME("beval_text", VAR_STRING), VV_RO}, - {VV_NAME("scrollstart", VAR_STRING), 0}, - {VV_NAME("swapname", VAR_STRING), VV_RO}, - {VV_NAME("swapchoice", VAR_STRING), 0}, - {VV_NAME("swapcommand", VAR_STRING), VV_RO}, - {VV_NAME("char", VAR_STRING), 0}, - {VV_NAME("mouse_win", VAR_NUMBER), 0}, - {VV_NAME("mouse_lnum", VAR_NUMBER), 0}, - {VV_NAME("mouse_col", VAR_NUMBER), 0}, - {VV_NAME("operator", VAR_STRING), VV_RO}, - {VV_NAME("searchforward", VAR_NUMBER), 0}, - {VV_NAME("hlsearch", VAR_NUMBER), 0}, - {VV_NAME("oldfiles", VAR_LIST), 0}, - {VV_NAME("windowid", VAR_NUMBER), VV_RO}, - {VV_NAME("progpath", VAR_STRING), VV_RO}, - {VV_NAME("command_output", VAR_STRING), 0}, - {VV_NAME("completed_item", VAR_DICT), VV_RO}, - {VV_NAME("option_new", VAR_STRING), VV_RO}, - {VV_NAME("option_old", VAR_STRING), VV_RO}, - {VV_NAME("option_type", VAR_STRING), VV_RO}, - {VV_NAME("errors", VAR_LIST), 0}, - {VV_NAME("msgpack_types", VAR_DICT), VV_RO}, + { VV_NAME("count", VAR_NUMBER), VV_COMPAT+VV_RO }, + { VV_NAME("count1", VAR_NUMBER), VV_RO }, + { VV_NAME("prevcount", VAR_NUMBER), VV_RO }, + { VV_NAME("errmsg", VAR_STRING), VV_COMPAT }, + { VV_NAME("warningmsg", VAR_STRING), 0 }, + { VV_NAME("statusmsg", VAR_STRING), 0 }, + { VV_NAME("shell_error", VAR_NUMBER), VV_COMPAT+VV_RO }, + { VV_NAME("this_session", VAR_STRING), VV_COMPAT }, + { VV_NAME("version", VAR_NUMBER), VV_COMPAT+VV_RO }, + { VV_NAME("lnum", VAR_NUMBER), VV_RO_SBX }, + { VV_NAME("termresponse", VAR_STRING), VV_RO }, + { VV_NAME("fname", VAR_STRING), VV_RO }, + { VV_NAME("lang", VAR_STRING), VV_RO }, + { VV_NAME("lc_time", VAR_STRING), VV_RO }, + { VV_NAME("ctype", VAR_STRING), VV_RO }, + { VV_NAME("charconvert_from", VAR_STRING), VV_RO }, + { VV_NAME("charconvert_to", VAR_STRING), VV_RO }, + { VV_NAME("fname_in", VAR_STRING), VV_RO }, + { VV_NAME("fname_out", VAR_STRING), VV_RO }, + { VV_NAME("fname_new", VAR_STRING), VV_RO }, + { VV_NAME("fname_diff", VAR_STRING), VV_RO }, + { VV_NAME("cmdarg", VAR_STRING), VV_RO }, + { VV_NAME("foldstart", VAR_NUMBER), VV_RO_SBX }, + { VV_NAME("foldend", VAR_NUMBER), VV_RO_SBX }, + { VV_NAME("folddashes", VAR_STRING), VV_RO_SBX }, + { VV_NAME("foldlevel", VAR_NUMBER), VV_RO_SBX }, + { VV_NAME("progname", VAR_STRING), VV_RO }, + { VV_NAME("servername", VAR_STRING), VV_RO }, + { VV_NAME("dying", VAR_NUMBER), VV_RO }, + { VV_NAME("exception", VAR_STRING), VV_RO }, + { VV_NAME("throwpoint", VAR_STRING), VV_RO }, + { VV_NAME("register", VAR_STRING), VV_RO }, + { VV_NAME("cmdbang", VAR_NUMBER), VV_RO }, + { VV_NAME("insertmode", VAR_STRING), VV_RO }, + { VV_NAME("val", VAR_UNKNOWN), VV_RO }, + { VV_NAME("key", VAR_UNKNOWN), VV_RO }, + { VV_NAME("profiling", VAR_NUMBER), VV_RO }, + { VV_NAME("fcs_reason", VAR_STRING), VV_RO }, + { VV_NAME("fcs_choice", VAR_STRING), 0 }, + { VV_NAME("beval_bufnr", VAR_NUMBER), VV_RO }, + { VV_NAME("beval_winnr", VAR_NUMBER), VV_RO }, + { VV_NAME("beval_lnum", VAR_NUMBER), VV_RO }, + { VV_NAME("beval_col", VAR_NUMBER), VV_RO }, + { VV_NAME("beval_text", VAR_STRING), VV_RO }, + { VV_NAME("scrollstart", VAR_STRING), 0 }, + { VV_NAME("swapname", VAR_STRING), VV_RO }, + { VV_NAME("swapchoice", VAR_STRING), 0 }, + { VV_NAME("swapcommand", VAR_STRING), VV_RO }, + { VV_NAME("char", VAR_STRING), 0 }, + { VV_NAME("mouse_win", VAR_NUMBER), 0 }, + { VV_NAME("mouse_lnum", VAR_NUMBER), 0 }, + { VV_NAME("mouse_col", VAR_NUMBER), 0 }, + { VV_NAME("operator", VAR_STRING), VV_RO }, + { VV_NAME("searchforward", VAR_NUMBER), 0 }, + { VV_NAME("hlsearch", VAR_NUMBER), 0 }, + { VV_NAME("oldfiles", VAR_LIST), 0 }, + { VV_NAME("windowid", VAR_NUMBER), VV_RO }, + { VV_NAME("progpath", VAR_STRING), VV_RO }, + { VV_NAME("command_output", VAR_STRING), 0 }, + { VV_NAME("completed_item", VAR_DICT), VV_RO }, + { VV_NAME("option_new", VAR_STRING), VV_RO }, + { VV_NAME("option_old", VAR_STRING), VV_RO }, + { VV_NAME("option_type", VAR_STRING), VV_RO }, + { VV_NAME("errors", VAR_LIST), 0 }, + { VV_NAME("msgpack_types", VAR_DICT), VV_RO }, }; /* shorthand */ @@ -7092,298 +7092,298 @@ static struct fst { /* implementation of function */ } functions[] = { - {"abs", 1, 1, f_abs}, - {"acos", 1, 1, f_acos}, /* WJMc */ - {"add", 2, 2, f_add}, - {"and", 2, 2, f_and}, - {"append", 2, 2, f_append}, - {"argc", 0, 0, f_argc}, - {"argidx", 0, 0, f_argidx}, - {"arglistid", 0, 2, f_arglistid}, - {"argv", 0, 1, f_argv}, - {"asin", 1, 1, f_asin}, // WJMc - {"assert_equal", 2, 3, f_assert_equal}, - {"assert_false", 1, 2, f_assert_false}, - {"assert_true", 1, 2, f_assert_true}, - {"atan", 1, 1, f_atan}, - {"atan2", 2, 2, f_atan2}, - {"browse", 4, 4, f_browse}, - {"browsedir", 2, 2, f_browsedir}, - {"bufexists", 1, 1, f_bufexists}, - {"buffer_exists", 1, 1, f_bufexists}, /* obsolete */ - {"buffer_name", 1, 1, f_bufname}, /* obsolete */ - {"buffer_number", 1, 1, f_bufnr}, /* obsolete */ - {"buflisted", 1, 1, f_buflisted}, - {"bufloaded", 1, 1, f_bufloaded}, - {"bufname", 1, 1, f_bufname}, - {"bufnr", 1, 2, f_bufnr}, - {"bufwinnr", 1, 1, f_bufwinnr}, - {"byte2line", 1, 1, f_byte2line}, - {"byteidx", 2, 2, f_byteidx}, - {"byteidxcomp", 2, 2, f_byteidxcomp}, - {"call", 2, 3, f_call}, - {"ceil", 1, 1, f_ceil}, - {"changenr", 0, 0, f_changenr}, - {"char2nr", 1, 2, f_char2nr}, - {"cindent", 1, 1, f_cindent}, - {"clearmatches", 0, 0, f_clearmatches}, - {"col", 1, 1, f_col}, - {"complete", 2, 2, f_complete}, - {"complete_add", 1, 1, f_complete_add}, - {"complete_check", 0, 0, f_complete_check}, - {"confirm", 1, 4, f_confirm}, - {"copy", 1, 1, f_copy}, - {"cos", 1, 1, f_cos}, - {"cosh", 1, 1, f_cosh}, - {"count", 2, 4, f_count}, - {"cscope_connection",0,3, f_cscope_connection}, - {"cursor", 1, 3, f_cursor}, - {"deepcopy", 1, 2, f_deepcopy}, - {"delete", 1, 1, f_delete}, - {"dictwatcheradd", 3, 3, f_dictwatcheradd}, - {"dictwatcherdel", 3, 3, f_dictwatcherdel}, - {"did_filetype", 0, 0, f_did_filetype}, - {"diff_filler", 1, 1, f_diff_filler}, - {"diff_hlID", 2, 2, f_diff_hlID}, - {"empty", 1, 1, f_empty}, - {"escape", 2, 2, f_escape}, - {"eval", 1, 1, f_eval}, - {"eventhandler", 0, 0, f_eventhandler}, - {"executable", 1, 1, f_executable}, - {"exepath", 1, 1, f_exepath}, - {"exists", 1, 1, f_exists}, - {"exp", 1, 1, f_exp}, - {"expand", 1, 3, f_expand}, - {"extend", 2, 3, f_extend}, - {"feedkeys", 1, 2, f_feedkeys}, - {"file_readable", 1, 1, f_filereadable}, /* obsolete */ - {"filereadable", 1, 1, f_filereadable}, - {"filewritable", 1, 1, f_filewritable}, - {"filter", 2, 2, f_filter}, - {"finddir", 1, 3, f_finddir}, - {"findfile", 1, 3, f_findfile}, - {"float2nr", 1, 1, f_float2nr}, - {"floor", 1, 1, f_floor}, - {"fmod", 2, 2, f_fmod}, - {"fnameescape", 1, 1, f_fnameescape}, - {"fnamemodify", 2, 2, f_fnamemodify}, - {"foldclosed", 1, 1, f_foldclosed}, - {"foldclosedend", 1, 1, f_foldclosedend}, - {"foldlevel", 1, 1, f_foldlevel}, - {"foldtext", 0, 0, f_foldtext}, - {"foldtextresult", 1, 1, f_foldtextresult}, - {"foreground", 0, 0, f_foreground}, - {"function", 1, 1, f_function}, - {"garbagecollect", 0, 1, f_garbagecollect}, - {"get", 2, 3, f_get}, - {"getbufline", 2, 3, f_getbufline}, - {"getbufvar", 2, 3, f_getbufvar}, - {"getchar", 0, 1, f_getchar}, - {"getcharmod", 0, 0, f_getcharmod}, - {"getcharsearch", 0, 0, f_getcharsearch}, - {"getcmdline", 0, 0, f_getcmdline}, - {"getcmdpos", 0, 0, f_getcmdpos}, - {"getcmdtype", 0, 0, f_getcmdtype}, - {"getcmdwintype", 0, 0, f_getcmdwintype}, - {"getcurpos", 0, 0, f_getcurpos}, - {"getcwd", 0, 0, f_getcwd}, - {"getfontname", 0, 1, f_getfontname}, - {"getfperm", 1, 1, f_getfperm}, - {"getfsize", 1, 1, f_getfsize}, - {"getftime", 1, 1, f_getftime}, - {"getftype", 1, 1, f_getftype}, - {"getline", 1, 2, f_getline}, - {"getloclist", 1, 1, f_getqflist}, - {"getmatches", 0, 0, f_getmatches}, - {"getpid", 0, 0, f_getpid}, - {"getpos", 1, 1, f_getpos}, - {"getqflist", 0, 0, f_getqflist}, - {"getreg", 0, 3, f_getreg}, - {"getregtype", 0, 1, f_getregtype}, - {"gettabvar", 2, 3, f_gettabvar}, - {"gettabwinvar", 3, 4, f_gettabwinvar}, - {"getwinposx", 0, 0, f_getwinposx}, - {"getwinposy", 0, 0, f_getwinposy}, - {"getwinvar", 2, 3, f_getwinvar}, - {"glob", 1, 3, f_glob}, - {"glob2regpat", 1, 1, f_glob2regpat}, - {"globpath", 2, 4, f_globpath}, - {"has", 1, 1, f_has}, - {"has_key", 2, 2, f_has_key}, - {"haslocaldir", 0, 0, f_haslocaldir}, - {"hasmapto", 1, 3, f_hasmapto}, - {"highlightID", 1, 1, f_hlID}, /* obsolete */ - {"highlight_exists",1, 1, f_hlexists}, /* obsolete */ - {"histadd", 2, 2, f_histadd}, - {"histdel", 1, 2, f_histdel}, - {"histget", 1, 2, f_histget}, - {"histnr", 1, 1, f_histnr}, - {"hlID", 1, 1, f_hlID}, - {"hlexists", 1, 1, f_hlexists}, - {"hostname", 0, 0, f_hostname}, - {"iconv", 3, 3, f_iconv}, - {"indent", 1, 1, f_indent}, - {"index", 2, 4, f_index}, - {"input", 1, 3, f_input}, - {"inputdialog", 1, 3, f_inputdialog}, - {"inputlist", 1, 1, f_inputlist}, - {"inputrestore", 0, 0, f_inputrestore}, - {"inputsave", 0, 0, f_inputsave}, - {"inputsecret", 1, 2, f_inputsecret}, - {"insert", 2, 3, f_insert}, - {"invert", 1, 1, f_invert}, - {"isdirectory", 1, 1, f_isdirectory}, - {"islocked", 1, 1, f_islocked}, - {"items", 1, 1, f_items}, - {"jobclose", 1, 2, f_jobclose}, - {"jobresize", 3, 3, f_jobresize}, - {"jobsend", 2, 2, f_jobsend}, - {"jobstart", 1, 2, f_jobstart}, - {"jobstop", 1, 1, f_jobstop}, - {"jobwait", 1, 2, f_jobwait}, - {"join", 1, 2, f_join}, - {"keys", 1, 1, f_keys}, - {"last_buffer_nr", 0, 0, f_last_buffer_nr}, /* obsolete */ - {"len", 1, 1, f_len}, - {"libcall", 3, 3, f_libcall}, - {"libcallnr", 3, 3, f_libcallnr}, - {"line", 1, 1, f_line}, - {"line2byte", 1, 1, f_line2byte}, - {"lispindent", 1, 1, f_lispindent}, - {"localtime", 0, 0, f_localtime}, - {"log", 1, 1, f_log}, - {"log10", 1, 1, f_log10}, - {"map", 2, 2, f_map}, - {"maparg", 1, 4, f_maparg}, - {"mapcheck", 1, 3, f_mapcheck}, - {"match", 2, 4, f_match}, - {"matchadd", 2, 4, f_matchadd}, - {"matchaddpos", 2, 4, f_matchaddpos}, - {"matcharg", 1, 1, f_matcharg}, - {"matchdelete", 1, 1, f_matchdelete}, - {"matchend", 2, 4, f_matchend}, - {"matchlist", 2, 4, f_matchlist}, - {"matchstr", 2, 4, f_matchstr}, - {"max", 1, 1, f_max}, - {"min", 1, 1, f_min}, - {"mkdir", 1, 3, f_mkdir}, - {"mode", 0, 1, f_mode}, - {"msgpackdump", 1, 1, f_msgpackdump}, - {"msgpackparse", 1, 1, f_msgpackparse}, - {"nextnonblank", 1, 1, f_nextnonblank}, - {"nr2char", 1, 2, f_nr2char}, - {"or", 2, 2, f_or}, - {"pathshorten", 1, 1, f_pathshorten}, - {"pow", 2, 2, f_pow}, - {"prevnonblank", 1, 1, f_prevnonblank}, - {"printf", 2, 19, f_printf}, - {"pumvisible", 0, 0, f_pumvisible}, - {"py3eval", 1, 1, f_py3eval}, - {"pyeval", 1, 1, f_pyeval}, - {"range", 1, 3, f_range}, - {"readfile", 1, 3, f_readfile}, - {"reltime", 0, 2, f_reltime}, - {"reltimestr", 1, 1, f_reltimestr}, - {"remove", 2, 3, f_remove}, - {"rename", 2, 2, f_rename}, - {"repeat", 2, 2, f_repeat}, - {"resolve", 1, 1, f_resolve}, - {"reverse", 1, 1, f_reverse}, - {"round", 1, 1, f_round}, - {"rpcnotify", 2, 64, f_rpcnotify}, - {"rpcrequest", 2, 64, f_rpcrequest}, - {"rpcstart", 1, 2, f_rpcstart}, - {"rpcstop", 1, 1, f_rpcstop}, - {"screenattr", 2, 2, f_screenattr}, - {"screenchar", 2, 2, f_screenchar}, - {"screencol", 0, 0, f_screencol}, - {"screenrow", 0, 0, f_screenrow}, - {"search", 1, 4, f_search}, - {"searchdecl", 1, 3, f_searchdecl}, - {"searchpair", 3, 7, f_searchpair}, - {"searchpairpos", 3, 7, f_searchpairpos}, - {"searchpos", 1, 4, f_searchpos}, - {"serverlist", 0, 0, f_serverlist}, - {"serverstart", 0, 1, f_serverstart}, - {"serverstop", 1, 1, f_serverstop}, - {"setbufvar", 3, 3, f_setbufvar}, - {"setcharsearch", 1, 1, f_setcharsearch}, - {"setcmdpos", 1, 1, f_setcmdpos}, - {"setline", 2, 2, f_setline}, - {"setloclist", 2, 3, f_setloclist}, - {"setmatches", 1, 1, f_setmatches}, - {"setpos", 2, 2, f_setpos}, - {"setqflist", 1, 2, f_setqflist}, - {"setreg", 2, 3, f_setreg}, - {"settabvar", 3, 3, f_settabvar}, - {"settabwinvar", 4, 4, f_settabwinvar}, - {"setwinvar", 3, 3, f_setwinvar}, - {"sha256", 1, 1, f_sha256}, - {"shellescape", 1, 2, f_shellescape}, - {"shiftwidth", 0, 0, f_shiftwidth}, - {"simplify", 1, 1, f_simplify}, - {"sin", 1, 1, f_sin}, - {"sinh", 1, 1, f_sinh}, - {"sort", 1, 3, f_sort}, - {"soundfold", 1, 1, f_soundfold}, - {"spellbadword", 0, 1, f_spellbadword}, - {"spellsuggest", 1, 3, f_spellsuggest}, - {"split", 1, 3, f_split}, - {"sqrt", 1, 1, f_sqrt}, - {"str2float", 1, 1, f_str2float}, - {"str2nr", 1, 2, f_str2nr}, - {"strchars", 1, 1, f_strchars}, - {"strdisplaywidth", 1, 2, f_strdisplaywidth}, - {"strftime", 1, 2, f_strftime}, - {"stridx", 2, 3, f_stridx}, - {"string", 1, 1, f_string}, - {"strlen", 1, 1, f_strlen}, - {"strpart", 2, 3, f_strpart}, - {"strridx", 2, 3, f_strridx}, - {"strtrans", 1, 1, f_strtrans}, - {"strwidth", 1, 1, f_strwidth}, - {"submatch", 1, 2, f_submatch}, - {"substitute", 4, 4, f_substitute}, - {"synID", 3, 3, f_synID}, - {"synIDattr", 2, 3, f_synIDattr}, - {"synIDtrans", 1, 1, f_synIDtrans}, - {"synconcealed", 2, 2, f_synconcealed}, - {"synstack", 2, 2, f_synstack}, - {"system", 1, 2, f_system}, - {"systemlist", 1, 3, f_systemlist}, - {"tabpagebuflist", 0, 1, f_tabpagebuflist}, - {"tabpagenr", 0, 1, f_tabpagenr}, - {"tabpagewinnr", 1, 2, f_tabpagewinnr}, - {"tagfiles", 0, 0, f_tagfiles}, - {"taglist", 1, 1, f_taglist}, - {"tan", 1, 1, f_tan}, - {"tanh", 1, 1, f_tanh}, - {"tempname", 0, 0, f_tempname}, - {"termopen", 1, 2, f_termopen}, - {"test", 1, 1, f_test}, - {"tolower", 1, 1, f_tolower}, - {"toupper", 1, 1, f_toupper}, - {"tr", 3, 3, f_tr}, - {"trunc", 1, 1, f_trunc}, - {"type", 1, 1, f_type}, - {"undofile", 1, 1, f_undofile}, - {"undotree", 0, 0, f_undotree}, - {"uniq", 1, 3, f_uniq}, - {"values", 1, 1, f_values}, - {"virtcol", 1, 1, f_virtcol}, - {"visualmode", 0, 1, f_visualmode}, - {"wildmenumode", 0, 0, f_wildmenumode}, - {"winbufnr", 1, 1, f_winbufnr}, - {"wincol", 0, 0, f_wincol}, - {"winheight", 1, 1, f_winheight}, - {"winline", 0, 0, f_winline}, - {"winnr", 0, 1, f_winnr}, - {"winrestcmd", 0, 0, f_winrestcmd}, - {"winrestview", 1, 1, f_winrestview}, - {"winsaveview", 0, 0, f_winsaveview}, - {"winwidth", 1, 1, f_winwidth}, - {"writefile", 2, 3, f_writefile}, - {"xor", 2, 2, f_xor}, + { "abs", 1, 1, f_abs }, + { "acos", 1, 1, f_acos }, // WJMc + { "add", 2, 2, f_add }, + { "and", 2, 2, f_and }, + { "append", 2, 2, f_append }, + { "argc", 0, 0, f_argc }, + { "argidx", 0, 0, f_argidx }, + { "arglistid", 0, 2, f_arglistid }, + { "argv", 0, 1, f_argv }, + { "asin", 1, 1, f_asin }, // WJMc + { "assert_equal", 2, 3, f_assert_equal }, + { "assert_false", 1, 2, f_assert_false }, + { "assert_true", 1, 2, f_assert_true }, + { "atan", 1, 1, f_atan }, + { "atan2", 2, 2, f_atan2 }, + { "browse", 4, 4, f_browse }, + { "browsedir", 2, 2, f_browsedir }, + { "bufexists", 1, 1, f_bufexists }, + { "buffer_exists", 1, 1, f_bufexists }, // obsolete + { "buffer_name", 1, 1, f_bufname }, // obsolete + { "buffer_number", 1, 1, f_bufnr }, // obsolete + { "buflisted", 1, 1, f_buflisted }, + { "bufloaded", 1, 1, f_bufloaded }, + { "bufname", 1, 1, f_bufname }, + { "bufnr", 1, 2, f_bufnr }, + { "bufwinnr", 1, 1, f_bufwinnr }, + { "byte2line", 1, 1, f_byte2line }, + { "byteidx", 2, 2, f_byteidx }, + { "byteidxcomp", 2, 2, f_byteidxcomp }, + { "call", 2, 3, f_call }, + { "ceil", 1, 1, f_ceil }, + { "changenr", 0, 0, f_changenr }, + { "char2nr", 1, 2, f_char2nr }, + { "cindent", 1, 1, f_cindent }, + { "clearmatches", 0, 0, f_clearmatches }, + { "col", 1, 1, f_col }, + { "complete", 2, 2, f_complete }, + { "complete_add", 1, 1, f_complete_add }, + { "complete_check", 0, 0, f_complete_check }, + { "confirm", 1, 4, f_confirm }, + { "copy", 1, 1, f_copy }, + { "cos", 1, 1, f_cos }, + { "cosh", 1, 1, f_cosh }, + { "count", 2, 4, f_count }, + { "cscope_connection", 0, 3, f_cscope_connection }, + { "cursor", 1, 3, f_cursor }, + { "deepcopy", 1, 2, f_deepcopy }, + { "delete", 1, 1, f_delete }, + { "dictwatcheradd", 3, 3, f_dictwatcheradd }, + { "dictwatcherdel", 3, 3, f_dictwatcherdel }, + { "did_filetype", 0, 0, f_did_filetype }, + { "diff_filler", 1, 1, f_diff_filler }, + { "diff_hlID", 2, 2, f_diff_hlID }, + { "empty", 1, 1, f_empty }, + { "escape", 2, 2, f_escape }, + { "eval", 1, 1, f_eval }, + { "eventhandler", 0, 0, f_eventhandler }, + { "executable", 1, 1, f_executable }, + { "exepath", 1, 1, f_exepath }, + { "exists", 1, 1, f_exists }, + { "exp", 1, 1, f_exp }, + { "expand", 1, 3, f_expand }, + { "extend", 2, 3, f_extend }, + { "feedkeys", 1, 2, f_feedkeys }, + { "file_readable", 1, 1, f_filereadable }, // obsolete + { "filereadable", 1, 1, f_filereadable }, + { "filewritable", 1, 1, f_filewritable }, + { "filter", 2, 2, f_filter }, + { "finddir", 1, 3, f_finddir }, + { "findfile", 1, 3, f_findfile }, + { "float2nr", 1, 1, f_float2nr }, + { "floor", 1, 1, f_floor }, + { "fmod", 2, 2, f_fmod }, + { "fnameescape", 1, 1, f_fnameescape }, + { "fnamemodify", 2, 2, f_fnamemodify }, + { "foldclosed", 1, 1, f_foldclosed }, + { "foldclosedend", 1, 1, f_foldclosedend }, + { "foldlevel", 1, 1, f_foldlevel }, + { "foldtext", 0, 0, f_foldtext }, + { "foldtextresult", 1, 1, f_foldtextresult }, + { "foreground", 0, 0, f_foreground }, + { "function", 1, 1, f_function }, + { "garbagecollect", 0, 1, f_garbagecollect }, + { "get", 2, 3, f_get }, + { "getbufline", 2, 3, f_getbufline }, + { "getbufvar", 2, 3, f_getbufvar }, + { "getchar", 0, 1, f_getchar }, + { "getcharmod", 0, 0, f_getcharmod }, + { "getcharsearch", 0, 0, f_getcharsearch }, + { "getcmdline", 0, 0, f_getcmdline }, + { "getcmdpos", 0, 0, f_getcmdpos }, + { "getcmdtype", 0, 0, f_getcmdtype }, + { "getcmdwintype", 0, 0, f_getcmdwintype }, + { "getcurpos", 0, 0, f_getcurpos }, + { "getcwd", 0, 0, f_getcwd }, + { "getfontname", 0, 1, f_getfontname }, + { "getfperm", 1, 1, f_getfperm }, + { "getfsize", 1, 1, f_getfsize }, + { "getftime", 1, 1, f_getftime }, + { "getftype", 1, 1, f_getftype }, + { "getline", 1, 2, f_getline }, + { "getloclist", 1, 1, f_getqflist }, + { "getmatches", 0, 0, f_getmatches }, + { "getpid", 0, 0, f_getpid }, + { "getpos", 1, 1, f_getpos }, + { "getqflist", 0, 0, f_getqflist }, + { "getreg", 0, 3, f_getreg }, + { "getregtype", 0, 1, f_getregtype }, + { "gettabvar", 2, 3, f_gettabvar }, + { "gettabwinvar", 3, 4, f_gettabwinvar }, + { "getwinposx", 0, 0, f_getwinposx }, + { "getwinposy", 0, 0, f_getwinposy }, + { "getwinvar", 2, 3, f_getwinvar }, + { "glob", 1, 3, f_glob }, + { "glob2regpat", 1, 1, f_glob2regpat }, + { "globpath", 2, 4, f_globpath }, + { "has", 1, 1, f_has }, + { "has_key", 2, 2, f_has_key }, + { "haslocaldir", 0, 0, f_haslocaldir }, + { "hasmapto", 1, 3, f_hasmapto }, + { "highlightID", 1, 1, f_hlID }, // obsolete + { "highlight_exists", 1, 1, f_hlexists }, // obsolete + { "histadd", 2, 2, f_histadd }, + { "histdel", 1, 2, f_histdel }, + { "histget", 1, 2, f_histget }, + { "histnr", 1, 1, f_histnr }, + { "hlID", 1, 1, f_hlID }, + { "hlexists", 1, 1, f_hlexists }, + { "hostname", 0, 0, f_hostname }, + { "iconv", 3, 3, f_iconv }, + { "indent", 1, 1, f_indent }, + { "index", 2, 4, f_index }, + { "input", 1, 3, f_input }, + { "inputdialog", 1, 3, f_inputdialog }, + { "inputlist", 1, 1, f_inputlist }, + { "inputrestore", 0, 0, f_inputrestore }, + { "inputsave", 0, 0, f_inputsave }, + { "inputsecret", 1, 2, f_inputsecret }, + { "insert", 2, 3, f_insert }, + { "invert", 1, 1, f_invert }, + { "isdirectory", 1, 1, f_isdirectory }, + { "islocked", 1, 1, f_islocked }, + { "items", 1, 1, f_items }, + { "jobclose", 1, 2, f_jobclose }, + { "jobresize", 3, 3, f_jobresize }, + { "jobsend", 2, 2, f_jobsend }, + { "jobstart", 1, 2, f_jobstart }, + { "jobstop", 1, 1, f_jobstop }, + { "jobwait", 1, 2, f_jobwait }, + { "join", 1, 2, f_join }, + { "keys", 1, 1, f_keys }, + { "last_buffer_nr", 0, 0, f_last_buffer_nr }, // obsolete + { "len", 1, 1, f_len }, + { "libcall", 3, 3, f_libcall }, + { "libcallnr", 3, 3, f_libcallnr }, + { "line", 1, 1, f_line }, + { "line2byte", 1, 1, f_line2byte }, + { "lispindent", 1, 1, f_lispindent }, + { "localtime", 0, 0, f_localtime }, + { "log", 1, 1, f_log }, + { "log10", 1, 1, f_log10 }, + { "map", 2, 2, f_map }, + { "maparg", 1, 4, f_maparg }, + { "mapcheck", 1, 3, f_mapcheck }, + { "match", 2, 4, f_match }, + { "matchadd", 2, 4, f_matchadd }, + { "matchaddpos", 2, 4, f_matchaddpos }, + { "matcharg", 1, 1, f_matcharg }, + { "matchdelete", 1, 1, f_matchdelete }, + { "matchend", 2, 4, f_matchend }, + { "matchlist", 2, 4, f_matchlist }, + { "matchstr", 2, 4, f_matchstr }, + { "max", 1, 1, f_max }, + { "min", 1, 1, f_min }, + { "mkdir", 1, 3, f_mkdir }, + { "mode", 0, 1, f_mode }, + { "msgpackdump", 1, 1, f_msgpackdump }, + { "msgpackparse", 1, 1, f_msgpackparse }, + { "nextnonblank", 1, 1, f_nextnonblank }, + { "nr2char", 1, 2, f_nr2char }, + { "or", 2, 2, f_or }, + { "pathshorten", 1, 1, f_pathshorten }, + { "pow", 2, 2, f_pow }, + { "prevnonblank", 1, 1, f_prevnonblank }, + { "printf", 2, 19, f_printf }, + { "pumvisible", 0, 0, f_pumvisible }, + { "py3eval", 1, 1, f_py3eval }, + { "pyeval", 1, 1, f_pyeval }, + { "range", 1, 3, f_range }, + { "readfile", 1, 3, f_readfile }, + { "reltime", 0, 2, f_reltime }, + { "reltimestr", 1, 1, f_reltimestr }, + { "remove", 2, 3, f_remove }, + { "rename", 2, 2, f_rename }, + { "repeat", 2, 2, f_repeat }, + { "resolve", 1, 1, f_resolve }, + { "reverse", 1, 1, f_reverse }, + { "round", 1, 1, f_round }, + { "rpcnotify", 2, 64, f_rpcnotify }, + { "rpcrequest", 2, 64, f_rpcrequest }, + { "rpcstart", 1, 2, f_rpcstart }, + { "rpcstop", 1, 1, f_rpcstop }, + { "screenattr", 2, 2, f_screenattr }, + { "screenchar", 2, 2, f_screenchar }, + { "screencol", 0, 0, f_screencol }, + { "screenrow", 0, 0, f_screenrow }, + { "search", 1, 4, f_search }, + { "searchdecl", 1, 3, f_searchdecl }, + { "searchpair", 3, 7, f_searchpair }, + { "searchpairpos", 3, 7, f_searchpairpos }, + { "searchpos", 1, 4, f_searchpos }, + { "serverlist", 0, 0, f_serverlist }, + { "serverstart", 0, 1, f_serverstart }, + { "serverstop", 1, 1, f_serverstop }, + { "setbufvar", 3, 3, f_setbufvar }, + { "setcharsearch", 1, 1, f_setcharsearch }, + { "setcmdpos", 1, 1, f_setcmdpos }, + { "setline", 2, 2, f_setline }, + { "setloclist", 2, 3, f_setloclist }, + { "setmatches", 1, 1, f_setmatches }, + { "setpos", 2, 2, f_setpos }, + { "setqflist", 1, 2, f_setqflist }, + { "setreg", 2, 3, f_setreg }, + { "settabvar", 3, 3, f_settabvar }, + { "settabwinvar", 4, 4, f_settabwinvar }, + { "setwinvar", 3, 3, f_setwinvar }, + { "sha256", 1, 1, f_sha256 }, + { "shellescape", 1, 2, f_shellescape }, + { "shiftwidth", 0, 0, f_shiftwidth }, + { "simplify", 1, 1, f_simplify }, + { "sin", 1, 1, f_sin }, + { "sinh", 1, 1, f_sinh }, + { "sort", 1, 3, f_sort }, + { "soundfold", 1, 1, f_soundfold }, + { "spellbadword", 0, 1, f_spellbadword }, + { "spellsuggest", 1, 3, f_spellsuggest }, + { "split", 1, 3, f_split }, + { "sqrt", 1, 1, f_sqrt }, + { "str2float", 1, 1, f_str2float }, + { "str2nr", 1, 2, f_str2nr }, + { "strchars", 1, 1, f_strchars }, + { "strdisplaywidth", 1, 2, f_strdisplaywidth }, + { "strftime", 1, 2, f_strftime }, + { "stridx", 2, 3, f_stridx }, + { "string", 1, 1, f_string }, + { "strlen", 1, 1, f_strlen }, + { "strpart", 2, 3, f_strpart }, + { "strridx", 2, 3, f_strridx }, + { "strtrans", 1, 1, f_strtrans }, + { "strwidth", 1, 1, f_strwidth }, + { "submatch", 1, 2, f_submatch }, + { "substitute", 4, 4, f_substitute }, + { "synID", 3, 3, f_synID }, + { "synIDattr", 2, 3, f_synIDattr }, + { "synIDtrans", 1, 1, f_synIDtrans }, + { "synconcealed", 2, 2, f_synconcealed }, + { "synstack", 2, 2, f_synstack }, + { "system", 1, 2, f_system }, + { "systemlist", 1, 3, f_systemlist }, + { "tabpagebuflist", 0, 1, f_tabpagebuflist }, + { "tabpagenr", 0, 1, f_tabpagenr }, + { "tabpagewinnr", 1, 2, f_tabpagewinnr }, + { "tagfiles", 0, 0, f_tagfiles }, + { "taglist", 1, 1, f_taglist }, + { "tan", 1, 1, f_tan }, + { "tanh", 1, 1, f_tanh }, + { "tempname", 0, 0, f_tempname }, + { "termopen", 1, 2, f_termopen }, + { "test", 1, 1, f_test }, + { "tolower", 1, 1, f_tolower }, + { "toupper", 1, 1, f_toupper }, + { "tr", 3, 3, f_tr }, + { "trunc", 1, 1, f_trunc }, + { "type", 1, 1, f_type }, + { "undofile", 1, 1, f_undofile }, + { "undotree", 0, 0, f_undotree }, + { "uniq", 1, 3, f_uniq }, + { "values", 1, 1, f_values }, + { "virtcol", 1, 1, f_virtcol }, + { "visualmode", 0, 1, f_visualmode }, + { "wildmenumode", 0, 0, f_wildmenumode }, + { "winbufnr", 1, 1, f_winbufnr }, + { "wincol", 0, 0, f_wincol }, + { "winheight", 1, 1, f_winheight }, + { "winline", 0, 0, f_winline }, + { "winnr", 0, 1, f_winnr }, + { "winrestcmd", 0, 0, f_winrestcmd }, + { "winrestview", 1, 1, f_winrestview }, + { "winsaveview", 0, 0, f_winsaveview }, + { "winwidth", 1, 1, f_winwidth }, + { "writefile", 2, 3, f_writefile }, + { "xor", 2, 2, f_xor }, }; -- cgit