Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Investigate hooking up VimL tests #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/apitest/vim_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <assert.h>
#include <stdio.h>
#include "libvim.h"

int main(int argc, char **argv) {
vimInit(argc, argv);

win_setwidth(5);
win_setheight(100);

printf("BEFORE\n");
vimExecute("so D:/libvim1/src/testdir/test_arglist.vim");
vimExecute("so D:/libvim1/src/testdir/runtest.vim");
printf("AFTER\n");
}
1 change: 1 addition & 0 deletions src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -9453,6 +9453,7 @@ prepare_assert_error(garray_T *gap)
void
assert_error(garray_T *gap)
{
printf("ASSERT ERROR!\n");
struct vimvar *vp = &vimvars[VV_ERRORS];

if (vp->vv_type != VAR_LIST || vimvars[VV_ERRORS].vv_list == NULL)
Expand Down
18 changes: 12 additions & 6 deletions src/ex_cmds2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,7 @@ ex_source(exarg_T *eap)
static void
cmd_source(char_u *fname, exarg_T *eap)
{
printf("Trying to source: %s\n", fname);
if (*fname == NUL)
emsg(_(e_argreq));

Expand Down Expand Up @@ -3333,6 +3334,7 @@ do_source(
int check_other, /* check for .vimrc and _vimrc */
int is_vimrc) /* DOSO_ value */
{
printf("DO SOURCE: %s\n", fname);
struct source_cookie cookie;
char_u *save_sourcing_name;
linenr_T save_sourcing_lnum;
Expand Down Expand Up @@ -3425,18 +3427,22 @@ do_source(

if (cookie.fp == NULL)
{
if (p_verbose > 0)
{
/* if (p_verbose > 0) */
/* { */
verbose_enter();
if (sourcing_name == NULL)
if (sourcing_name == NULL) {
printf("could not source %s\n");
smsg(_("could not source \"%s\""), fname);
else
}
else {
printf("could not source %s\n");
smsg(_("line %ld: could not source \"%s\""),
sourcing_lnum, fname);
sourcing_lnum, fname); }
verbose_leave();
}
/* } */
goto theend;
}
printf("file exists\n");

/*
* The file exists.
Expand Down
4 changes: 3 additions & 1 deletion src/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int verbose_did_open = FALSE;
* Set: When any message is written to the screen.
* msg_nowait No extra delay for the last drawn message.
* Used in normal_cmd() before the mode message is drawn.
* emsg_on_display There was an error message recently. Indicates that there
* emsg_on_displa There was an error message recently. Indicates that there
* should be a delay before redrawing.
* msg_scroll The next message should not overwrite the current one.
* msg_scrolled How many lines the screen has been scrolled (because of
Expand Down Expand Up @@ -359,6 +359,7 @@ int vim_snprintf(char *str, size_t str_m, const char *fmt, ...);
int
smsg(const char *s, ...)
{
printf("SMSG: %s\n", s);
va_list arglist;

va_start(arglist, s);
Expand Down Expand Up @@ -712,6 +713,7 @@ emsg_core(char_u *s)
int
emsg(char *s)
{
printf("EMSG: %s\n", s);
/* Skip this if not giving error messages at the moment. */
if (!emsg_not_now())
return emsg_core((char_u *)s);
Expand Down
2 changes: 1 addition & 1 deletion src/testdir/test_assert.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
" Test that the methods used for testing work.

func Test_assert_false()
call assert_equal(0, assert_false(0))
call assert_equal(900, assert_false(0))
call assert_equal(0, assert_false(v:false))

call assert_equal(1, assert_false(123))
Expand Down