neovim/test/old/testdir
..
crash
pyxfile
samples
sautest/autoload
check.vim
dotest.in
load.vim
Make_all.mak
Makefile
mouse.vim
README.txt
runnvim.sh
runnvim.vim
runtest.vim
screendump.vim
script_util.vim
setup.vim
shared.vim
suite.sh
summarize.vim
term_util.vim
test1.in
test1.ok
test_alot_latin.vim
test_alot_utf8.vim
test_alot.vim
test_arabic.vim
test_arglist.vim
test_assert.vim
test_autochdir.vim
test_autocmd.vim
test_autoload.vim
test_backspace_opt.vim
test_backup.vim
test_blob.vim
test_blockedit.vim
test_breakindent.vim
test_buffer.vim
test_bufline.vim
test_bufwintabinfo.vim
test_cd.vim
test_cdo.vim
test_changedtick.vim
test_changelist.vim
test_charsearch_utf8.vim
test_charsearch.vim
test_checkpath.vim
test_cindent.vim
test_cjk_linebreak.vim
test_clientserver.vim
test_close_count.vim
test_cmdline.vim
test_cmdwin.vim
test_codestyle.vim
test_command_count.vim
test_comments.vim
test_comparators.vim
test_compiler.vim
test_conceal.vim
test_const.vim
test_cpoptions.vim
test_crash.vim
test_cursor_func.vim
test_cursorline.vim
test_curswant.vim
test_debugger.vim
test_delete.vim
test_diffmode.vim
test_digraph.vim
test_display.vim
test_edit.vim
test_environ.vim
test_erasebackword.vim
test_escaped_glob.vim
test_eval_stuff.vim
test_ex_equal.vim
test_ex_mode.vim
test_ex_undo.vim
test_ex_z.vim
test_excmd.vim
test_exec_while_if.vim
test_execute_func.vim
test_exists_autocmd.vim
test_exists.vim
test_exit.vim
test_expand_func.vim
test_expand.vim
test_expr_utf8.vim
test_expr.vim
test_file_perm.vim
test_file_size.vim
test_filechanged.vim
test_fileformat.vim
test_filetype.vim
test_filter_cmd.vim
test_filter_map.vim
test_find_complete.vim
test_findfile.vim
test_fixeol.vim
test_flatten.vim
test_float_func.vim
test_fnameescape.vim
test_fnamemodify.vim
test_fold.vim
test_format.vim
test_functions.vim
test_ga.vim
test_getcwd.vim
test_getvar.vim
test_gf.vim
test_glob2regpat.vim
test_global.vim
test_gn.vim
test_goto.vim
test_gui.vim
test_help_tagjump.vim
test_help.vim
test_hide.vim
test_highlight.vim
test_history.vim
test_hlsearch.vim
test_increment_dbcs.vim
test_increment.vim
test_indent.vim
test_input.vim
test_ins_complete_no_halt.vim
test_ins_complete.vim
test_interrupt.vim
test_join.vim
test_jumplist.vim
test_lambda.vim
test_langmap.vim
test_largefile.vim
test_let.vim
test_lineending.vim
test_lispindent.vim
test_listchars.vim
test_listdict.vim
test_listlbr_utf8.vim
test_listlbr.vim
test_makeencoding.py
test_makeencoding.vim
test_map_functions.vim
test_mapping.vim
test_marks.vim
test_match.vim
test_matchadd_conceal_utf8.vim
test_matchadd_conceal.vim
test_matchfuzzy.vim
test_matchparen.vim
test_menu.vim
test_messages.vim
test_method.vim
test_mksession_utf8.vim
test_mksession.vim
test_modeline.vim
test_move.vim
test_nested_function.vim
test_normal.vim
test_number.vim
test_options.vim
test_packadd.vim
test_partial.vim
test_paste.vim
test_perl.vim
test_plus_arg_edit.vim
test_popup.vim
test_preview.vim
test_profile.vim
test_prompt_buffer.vim
test_put.vim
test_python3.vim
test_pyx3.vim
test_quickfix.vim
test_quotestar.vim
test_random.vim
test_recover.vim
test_regex_char_classes.vim
test_regexp_latin.vim
test_regexp_utf8.vim
test_registers.vim
test_reltime.vim
test_rename.vim
test_retab.vim
test_ruby.vim
test_scriptnames.vim
test_scroll_opt.vim
test_scrollbind.vim
test_search_stat.vim
test_search.vim
test_searchpos.vim
test_selectmode.vim
test_set.vim
test_sha256.vim
test_shell.vim
test_shift.vim
test_signals.vim
test_signs.vim
test_sleep.vim
test_smartindent.vim
test_sort.vim
test_source_utf8.vim
test_source.vim
test_spell_utf8.vim
test_spell.vim
test_spellfile.vim
test_startup_utf8.vim
test_startup.vim
test_stat.vim
test_statusline.vim
test_substitute.vim
test_suspend.vim
test_swap.vim
test_syn_attr.vim
test_syntax.vim
test_system.vim
test_tab.vim
test_tabline.vim
test_tabpage.vim
test_tagcase.vim
test_tagfunc.vim
test_tagjump.vim
test_taglist.vim
test_termcodes.vim
test_termdebug.vim
test_textformat.vim
test_textobjects.vim
test_timers.vim
test_true_false.vim
test_trycatch.vim
test_undo.vim
test_unlet.vim
test_user_func.vim
test_usercommands.vim
test_utf8_comparisons.vim
test_utf8.vim
test_vartabs.vim
test_version.vim
test_viminfo.vim
test_vimscript.vim
test_virtualedit.vim
test_visual.vim
test_winbuf_close.vim
test_window_cmd.vim
test_window_id.vim
test_windows_home.vim
test_wnext.vim
test_wordcount.vim
test_writefile.vim
test.sh
unix.vim
view_util.vim
vim9.vim

This directory contains tests for various Vim features.
For testing an indent script see runtime/indent/testdir/README.txt.

If it makes sense, add a new test method to an already existing file.  You may
want to separate it from other tests with comment lines.

TO ADD A NEW STYLE TEST:

1) Create a test_<subject>.vim file.
2) Add test_<subject>.res to NEW_TESTS_RES in Make_all.mak in alphabetical
   order.
3) Also add an entry "test_<subject>" to NEW_TESTS in Make_all.mak.
4) Use make test_<subject> to run a single test.

At 2), instead of running the test separately, it can be included in
"test_alot".  Do this for quick tests without side effects.  The test runs a
bit faster, because Vim doesn't have to be started, one Vim instance runs many
tests.

At 4), to run a test in GUI, add "GUI_FLAG=-g" to the make command.


What you can use (see test_assert.vim for an example):

- Call assert_equal(), assert_true(), assert_false(), etc.

- Use assert_fails() to check for expected errors.

- Use try/catch to avoid an exception aborts the test.

- Use test_alloc_fail() to have memory allocation fail.  This makes it possible
  to check memory allocation failures are handled gracefully.  You need to
  change the source code to add an ID to the allocation.  Add a new one to
  alloc_id_T, before aid_last.

- Use test_override() to make Vim behave differently, e.g.  if char_avail()
  must return FALSE for a while.  E.g. to trigger the CursorMovedI autocommand
  event. See test_cursor_func.vim for an example.

- If the bug that is being tested isn't fixed yet, you can throw an exception
  with "Skipped" so that it's clear this still needs work.  E.g.: throw
  "Skipped: Bug with <c-e> and popupmenu not fixed yet"

- The following environment variables are recognized and can be set to
  influence the behavior of the test suite (see runtest.vim for details)

  - $TEST_MAY_FAIL=Test_channel_one    - ignore those failing tests
  - $TEST_FILTER=Test_channel    - only run test that match this pattern
  - $TEST_SKIP_PAT=Test_channel  - skip tests that match this pattern
  - $TEST_NO_RETRY=yes           - do not try to re-run failing tests
  You can also set them in Vim:
    :let $TEST_MAY_FAIL = 'Test_channel_one'
    :let $TEST_FILTER = '_set_mode'
    :let $TEST_SKIP_PAT = 'Test_loop_forever'
    :let $TEST_NO_RETRY = 'yes'
  Use an empty string to revert, e.g.:
    :let $TEST_FILTER = ''

- See the start of runtest.vim for more help.


TO ADD A SCREEN DUMP TEST:

Mostly the same as writing a new style test.  Additionally, see help on
"terminal-dumptest".  Put the reference dump in "dumps/Test_func_name.dump".


OLD STYLE TESTS:

There are a few tests that are used when Vim was built without the +eval
feature.  These cannot use the "assert" functions, therefore they consist of a
.in file that contains Normal mode commands between STARTTEST and ENDTEST.
They modify the file and the result gets written in the test.out file.  This
is then compared with the .ok file.  If they are equal the test passed.  If
they differ the test failed.


RUNNING THE TESTS:

To run a single test from the src directory:

    $ make test_<name>

The below commands should be run from the src/testdir directory.

To run a single test:

    $ make test_<name>.res

The file 'messages' contains the messages generated by the test script.  If a
test fails, then the test.log file contains the error messages.  If all the
tests are successful, then this file will be an empty file.

- To run a single test function from a test script:

    $ ../vim -u NONE -S runtest.vim <test_file>.vim <function_name>

- To execute only specific test functions, add a second argument:

	 $ ../vim -u NONE -S runtest.vim test_channel.vim open_delay


- To run all the tests:

    $ make

- To run the test on MS-Windows using the MSVC nmake:

    > nmake -f Make_dos.mak

- To run the tests with GUI Vim:

    $ make GUI_FLAG=-g

    or

    $ make VIMPROG=../gvim

- To cleanup the temporary files after running the tests:

    $ make clean