aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-04-20 17:44:13 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-04-23 18:17:04 +0200
commit052498ed42780a76daea589d063cd8947a894673 (patch)
treeb6c85416a4d7ced5eabb0a7a3866f5e0fee886cc
parentc5af5c0b9ab84c86f84e32210512923e7eb641ba (diff)
downloadrneovim-052498ed42780a76daea589d063cd8947a894673.tar.gz
rneovim-052498ed42780a76daea589d063cd8947a894673.tar.bz2
rneovim-052498ed42780a76daea589d063cd8947a894673.zip
test: improve test conventions
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
-rw-r--r--runtime/doc/dev_tools.txt3
-rwxr-xr-xscripts/legacy2luatest.pl300
-rw-r--r--test/README.md11
-rw-r--r--test/benchmark/autocmd_spec.lua6
-rw-r--r--test/benchmark/bench_regexp_spec.lua7
-rw-r--r--test/benchmark/preload.lua2
-rw-r--r--test/benchmark/screenpos_spec.lua14
-rw-r--r--test/benchmark/treesitter_spec.lua8
-rw-r--r--test/functional/api/autocmd_spec.lua13
-rw-r--r--test/functional/api/buffer_spec.lua30
-rw-r--r--test/functional/api/buffer_updates_spec.lua24
-rw-r--r--test/functional/api/command_spec.lua19
-rw-r--r--test/functional/api/extmark_spec.lua21
-rw-r--r--test/functional/api/highlight_spec.lua18
-rw-r--r--test/functional/api/keymap_spec.lua31
-rw-r--r--test/functional/api/menu_spec.lua8
-rw-r--r--test/functional/api/proc_spec.lua11
-rw-r--r--test/functional/api/server_notifications_spec.lua14
-rw-r--r--test/functional/api/server_requests_spec.lua39
-rw-r--r--test/functional/api/tabpage_spec.lua18
-rw-r--r--test/functional/api/ui_spec.lua18
-rw-r--r--test/functional/api/version_spec.lua8
-rw-r--r--test/functional/api/vim_spec.lua85
-rw-r--r--test/functional/api/window_spec.lua40
-rw-r--r--test/functional/autocmd/autocmd_oldtest_spec.lua15
-rw-r--r--test/functional/autocmd/autocmd_spec.lua27
-rw-r--r--test/functional/autocmd/bufenter_spec.lua15
-rw-r--r--test/functional/autocmd/bufmodifiedset_spec.lua11
-rw-r--r--test/functional/autocmd/cmdline_spec.lua17
-rw-r--r--test/functional/autocmd/cursorhold_spec.lua11
-rw-r--r--test/functional/autocmd/cursormoved_spec.lua13
-rw-r--r--test/functional/autocmd/dirchanged_spec.lua13
-rw-r--r--test/functional/autocmd/filetype_spec.lua10
-rw-r--r--test/functional/autocmd/focus_spec.lua8
-rw-r--r--test/functional/autocmd/modechanged_spec.lua10
-rw-r--r--test/functional/autocmd/recording_spec.lua9
-rw-r--r--test/functional/autocmd/safestate_spec.lua12
-rw-r--r--test/functional/autocmd/searchwrapped_spec.lua13
-rw-r--r--test/functional/autocmd/show_spec.lua15
-rw-r--r--test/functional/autocmd/signal_spec.lua11
-rw-r--r--test/functional/autocmd/tabclose_spec.lua10
-rw-r--r--test/functional/autocmd/tabnew_spec.lua9
-rw-r--r--test/functional/autocmd/tabnewentered_spec.lua15
-rw-r--r--test/functional/autocmd/termxx_spec.lua15
-rw-r--r--test/functional/autocmd/textchanged_spec.lua16
-rw-r--r--test/functional/autocmd/textyankpost_spec.lua10
-rw-r--r--test/functional/autocmd/win_scrolled_resized_spec.lua17
-rw-r--r--test/functional/core/channels_spec.lua18
-rw-r--r--test/functional/core/exit_spec.lua31
-rw-r--r--test/functional/core/fileio_spec.lua37
-rw-r--r--test/functional/core/job_spec.lua53
-rw-r--r--test/functional/core/log_spec.lua14
-rw-r--r--test/functional/core/main_spec.lua15
-rw-r--r--test/functional/core/path_spec.lua18
-rw-r--r--test/functional/core/remote_spec.lua25
-rw-r--r--test/functional/core/spellfile_spec.lua13
-rw-r--r--test/functional/core/startup_spec.lua43
-rw-r--r--test/functional/editor/K_spec.lua14
-rw-r--r--test/functional/editor/completion_spec.lua20
-rw-r--r--test/functional/editor/count_spec.lua11
-rw-r--r--test/functional/editor/ctrl_c_spec.lua10
-rw-r--r--test/functional/editor/fold_spec.lua21
-rw-r--r--test/functional/editor/jump_spec.lua15
-rw-r--r--test/functional/editor/lang_spec.lua12
-rw-r--r--test/functional/editor/langmap_spec.lua19
-rw-r--r--test/functional/editor/macro_spec.lua19
-rw-r--r--test/functional/editor/mark_spec.lua40
-rw-r--r--test/functional/editor/meta_key_spec.lua16
-rw-r--r--test/functional/editor/mode_cmdline_spec.lua12
-rw-r--r--test/functional/editor/mode_insert_spec.lua20
-rw-r--r--test/functional/editor/mode_normal_spec.lua14
-rw-r--r--test/functional/editor/put_spec.lua19
-rw-r--r--test/functional/editor/search_spec.lua8
-rw-r--r--test/functional/editor/tabpage_spec.lua21
-rw-r--r--test/functional/editor/undo_spec.lua25
-rw-r--r--test/functional/ex_cmds/append_spec.lua17
-rw-r--r--test/functional/ex_cmds/arg_spec.lua16
-rw-r--r--test/functional/ex_cmds/cd_spec.lua17
-rw-r--r--test/functional/ex_cmds/cmd_map_spec.lua22
-rw-r--r--test/functional/ex_cmds/debug_spec.lua7
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua22
-rw-r--r--test/functional/ex_cmds/digraphs_spec.lua9
-rw-r--r--test/functional/ex_cmds/drop_spec.lua9
-rw-r--r--test/functional/ex_cmds/echo_spec.lua23
-rw-r--r--test/functional/ex_cmds/edit_spec.lua10
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua8
-rw-r--r--test/functional/ex_cmds/excmd_spec.lua12
-rw-r--r--test/functional/ex_cmds/file_spec.lua12
-rw-r--r--test/functional/ex_cmds/grep_spec.lua6
-rw-r--r--test/functional/ex_cmds/help_spec.lua15
-rw-r--r--test/functional/ex_cmds/highlight_spec.lua16
-rw-r--r--test/functional/ex_cmds/ls_spec.lua16
-rw-r--r--test/functional/ex_cmds/make_spec.lua16
-rw-r--r--test/functional/ex_cmds/map_spec.lua21
-rw-r--r--test/functional/ex_cmds/menu_spec.lua12
-rw-r--r--test/functional/ex_cmds/mksession_spec.lua15
-rw-r--r--test/functional/ex_cmds/mkview_spec.lua13
-rw-r--r--test/functional/ex_cmds/normal_spec.lua16
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua17
-rw-r--r--test/functional/ex_cmds/print_commands_spec.lua6
-rw-r--r--test/functional/ex_cmds/profile_spec.lua15
-rw-r--r--test/functional/ex_cmds/quickfix_commands_spec.lua17
-rw-r--r--test/functional/ex_cmds/quit_spec.lua5
-rw-r--r--test/functional/ex_cmds/script_spec.lua15
-rw-r--r--test/functional/ex_cmds/sign_spec.lua10
-rw-r--r--test/functional/ex_cmds/source_spec.lua28
-rw-r--r--test/functional/ex_cmds/swapfile_preserve_recover_spec.lua40
-rw-r--r--test/functional/ex_cmds/syntax_spec.lua7
-rw-r--r--test/functional/ex_cmds/trust_spec.lua17
-rw-r--r--test/functional/ex_cmds/undojoin_spec.lua15
-rw-r--r--test/functional/ex_cmds/verbose_spec.lua13
-rw-r--r--test/functional/ex_cmds/wincmd_spec.lua10
-rw-r--r--test/functional/ex_cmds/write_spec.lua14
-rw-r--r--test/functional/ex_cmds/wundo_spec.lua11
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua8
-rw-r--r--test/functional/example_spec.lua9
-rw-r--r--test/functional/legacy/002_filename_recognition_spec.lua7
-rw-r--r--test/functional/legacy/004_bufenter_with_modelines_spec.lua7
-rw-r--r--test/functional/legacy/005_bufleave_delete_buffer_spec.lua9
-rw-r--r--test/functional/legacy/007_ball_buffer_list_spec.lua7
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua10
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua8
-rw-r--r--test/functional/legacy/012_directory_spec.lua21
-rw-r--r--test/functional/legacy/015_alignment_spec.lua7
-rw-r--r--test/functional/legacy/018_unset_smart_indenting_spec.lua12
-rw-r--r--test/functional/legacy/019_smarttab_expandtab_spec.lua7
-rw-r--r--test/functional/legacy/020_blockwise_visual_spec.lua7
-rw-r--r--test/functional/legacy/021_control_wi_spec.lua7
-rw-r--r--test/functional/legacy/023_edit_arguments_spec.lua9
-rw-r--r--test/functional/legacy/025_jump_tag_hidden_spec.lua8
-rw-r--r--test/functional/legacy/026_execute_while_if_spec.lua10
-rw-r--r--test/functional/legacy/028_source_ctrl_v_spec.lua7
-rw-r--r--test/functional/legacy/029_join_spec.lua12
-rw-r--r--test/functional/legacy/030_fileformats_spec.lua12
-rw-r--r--test/functional/legacy/031_close_commands_spec.lua18
-rw-r--r--test/functional/legacy/033_lisp_indent_spec.lua9
-rw-r--r--test/functional/legacy/034_user_function_spec.lua7
-rw-r--r--test/functional/legacy/035_increment_and_decrement_spec.lua7
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua10
-rw-r--r--test/functional/legacy/038_virtual_replace_spec.lua7
-rw-r--r--test/functional/legacy/039_visual_block_mode_commands_spec.lua14
-rw-r--r--test/functional/legacy/043_magic_settings_spec.lua7
-rw-r--r--test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua7
-rw-r--r--test/functional/legacy/046_multi_line_regexps_spec.lua7
-rw-r--r--test/functional/legacy/054_buffer_local_autocommands_spec.lua8
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua7
-rw-r--r--test/functional/legacy/056_script_local_function_spec.lua7
-rw-r--r--test/functional/legacy/057_sort_spec.lua7
-rw-r--r--test/functional/legacy/060_exists_and_has_functions_spec.lua8
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua17
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua6
-rw-r--r--test/functional/legacy/065_float_and_logic_operators_spec.lua7
-rw-r--r--test/functional/legacy/066_visual_block_tab_spec.lua7
-rw-r--r--test/functional/legacy/067_augroup_exists_spec.lua7
-rw-r--r--test/functional/legacy/068_text_formatting_spec.lua12
-rw-r--r--test/functional/legacy/069_multibyte_formatting_spec.lua6
-rw-r--r--test/functional/legacy/072_undo_file_spec.lua7
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua6
-rw-r--r--test/functional/legacy/078_swapfile_recover_spec.lua5
-rw-r--r--test/functional/legacy/081_coptions_movement_spec.lua7
-rw-r--r--test/functional/legacy/082_string_comparison_spec.lua7
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua8
-rw-r--r--test/functional/legacy/090_sha256_spec.lua7
-rw-r--r--test/functional/legacy/091_context_variables_spec.lua7
-rw-r--r--test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua7
-rw-r--r--test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua7
-rw-r--r--test/functional/legacy/094_visual_mode_operators_spec.lua7
-rw-r--r--test/functional/legacy/095_regexp_multibyte_spec.lua7
-rw-r--r--test/functional/legacy/096_location_list_spec.lua7
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua8
-rw-r--r--test/functional/legacy/101_hlsearch_spec.lua7
-rw-r--r--test/functional/legacy/102_fnameescape_spec.lua7
-rw-r--r--test/functional/legacy/103_visual_mode_reset_spec.lua7
-rw-r--r--test/functional/legacy/106_errorformat_spec.lua7
-rw-r--r--test/functional/legacy/107_adjust_window_and_contents_spec.lua10
-rw-r--r--test/functional/legacy/108_backtrace_debug_commands_spec.lua9
-rw-r--r--test/functional/legacy/arglist_spec.lua10
-rw-r--r--test/functional/legacy/assert_spec.lua18
-rw-r--r--test/functional/legacy/autochdir_spec.lua12
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua31
-rw-r--r--test/functional/legacy/autocmd_spec.lua12
-rw-r--r--test/functional/legacy/autoformat_join_spec.lua9
-rw-r--r--test/functional/legacy/breakindent_spec.lua11
-rw-r--r--test/functional/legacy/changelist_spec.lua7
-rw-r--r--test/functional/legacy/charsearch_spec.lua7
-rw-r--r--test/functional/legacy/close_count_spec.lua13
-rw-r--r--test/functional/legacy/cmdline_spec.lua15
-rw-r--r--test/functional/legacy/command_count_spec.lua7
-rw-r--r--test/functional/legacy/comparators_spec.lua8
-rw-r--r--test/functional/legacy/conceal_spec.lua16
-rw-r--r--test/functional/legacy/cpoptions_spec.lua9
-rw-r--r--test/functional/legacy/crash_spec.lua11
-rw-r--r--test/functional/legacy/debugger_spec.lua10
-rw-r--r--test/functional/legacy/delete_spec.lua10
-rw-r--r--test/functional/legacy/digraph_spec.lua7
-rw-r--r--test/functional/legacy/display_spec.lua12
-rw-r--r--test/functional/legacy/edit_spec.lua11
-rw-r--r--test/functional/legacy/erasebackword_spec.lua5
-rw-r--r--test/functional/legacy/eval_spec.lua16
-rw-r--r--test/functional/legacy/ex_mode_spec.lua16
-rw-r--r--test/functional/legacy/excmd_spec.lua22
-rw-r--r--test/functional/legacy/fixeol_spec.lua7
-rw-r--r--test/functional/legacy/fnamemodify_spec.lua10
-rw-r--r--test/functional/legacy/fold_spec.lua15
-rw-r--r--test/functional/legacy/function_sort_spec.lua11
-rw-r--r--test/functional/legacy/getcwd_spec.lua10
-rw-r--r--test/functional/legacy/gf_spec.lua8
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua8
-rw-r--r--test/functional/legacy/global_spec.lua11
-rw-r--r--test/functional/legacy/highlight_spec.lua16
-rw-r--r--test/functional/legacy/increment_spec.lua16
-rw-r--r--test/functional/legacy/insertcount_spec.lua7
-rw-r--r--test/functional/legacy/join_spec.lua8
-rw-r--r--test/functional/legacy/lispwords_spec.lua12
-rw-r--r--test/functional/legacy/listchars_spec.lua7
-rw-r--r--test/functional/legacy/listlbr_spec.lua7
-rw-r--r--test/functional/legacy/listlbr_utf8_spec.lua11
-rw-r--r--test/functional/legacy/mapping_spec.lua12
-rw-r--r--test/functional/legacy/marks_spec.lua7
-rw-r--r--test/functional/legacy/match_spec.lua9
-rw-r--r--test/functional/legacy/matchparen_spec.lua10
-rw-r--r--test/functional/legacy/memory_usage_spec.lua18
-rw-r--r--test/functional/legacy/messages_spec.lua17
-rw-r--r--test/functional/legacy/mksession_spec.lua10
-rw-r--r--test/functional/legacy/move_spec.lua9
-rw-r--r--test/functional/legacy/nested_function_spec.lua7
-rw-r--r--test/functional/legacy/normal_spec.lua14
-rw-r--r--test/functional/legacy/number_spec.lua11
-rw-r--r--test/functional/legacy/options_spec.lua12
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua18
-rw-r--r--test/functional/legacy/put_spec.lua12
-rw-r--r--test/functional/legacy/qf_title_spec.lua7
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua11
-rw-r--r--test/functional/legacy/search_mbyte_spec.lua12
-rw-r--r--test/functional/legacy/search_spec.lua18
-rw-r--r--test/functional/legacy/search_stat_spec.lua5
-rw-r--r--test/functional/legacy/signs_spec.lua5
-rw-r--r--test/functional/legacy/source_spec.lua8
-rw-r--r--test/functional/legacy/statusline_spec.lua9
-rw-r--r--test/functional/legacy/substitute_spec.lua12
-rw-r--r--test/functional/legacy/syn_attr_spec.lua10
-rw-r--r--test/functional/legacy/tabline_spec.lua9
-rw-r--r--test/functional/legacy/tagcase_spec.lua16
-rw-r--r--test/functional/legacy/textobjects_spec.lua13
-rw-r--r--test/functional/legacy/undolevels_spec.lua10
-rw-r--r--test/functional/legacy/utf8_spec.lua14
-rw-r--r--test/functional/legacy/vimscript_spec.lua11
-rw-r--r--test/functional/legacy/visual_spec.lua10
-rw-r--r--test/functional/legacy/window_cmd_spec.lua13
-rw-r--r--test/functional/legacy/wordcount_spec.lua12
-rw-r--r--test/functional/legacy/writefile_spec.lua5
-rw-r--r--test/functional/lua/api_spec.lua13
-rw-r--r--test/functional/lua/base64_spec.lua8
-rw-r--r--test/functional/lua/buffer_updates_spec.lua21
-rw-r--r--test/functional/lua/command_line_completion_spec.lua7
-rw-r--r--test/functional/lua/commands_spec.lua23
-rw-r--r--test/functional/lua/comment_spec.lua13
-rw-r--r--test/functional/lua/diagnostic_spec.lua23
-rw-r--r--test/functional/lua/ffi_spec.lua8
-rw-r--r--test/functional/lua/filetype_spec.lua16
-rw-r--r--test/functional/lua/fs_spec.lua15
-rw-r--r--test/functional/lua/glob_spec.lua10
-rw-r--r--test/functional/lua/highlight_spec.lua16
-rw-r--r--test/functional/lua/inspector_spec.lua10
-rw-r--r--test/functional/lua/iter_spec.lua3
-rw-r--r--test/functional/lua/json_spec.lua8
-rw-r--r--test/functional/lua/loader_spec.lua9
-rw-r--r--test/functional/lua/loop_spec.lua16
-rw-r--r--test/functional/lua/luaeval_spec.lua19
-rw-r--r--test/functional/lua/mpack_spec.lua7
-rw-r--r--test/functional/lua/overrides_spec.lua17
-rw-r--r--test/functional/lua/runtime_spec.lua17
-rw-r--r--test/functional/lua/secure_spec.lua27
-rw-r--r--test/functional/lua/snippet_spec.lua17
-rw-r--r--test/functional/lua/spell_spec.lua8
-rw-r--r--test/functional/lua/system_spec.lua8
-rw-r--r--test/functional/lua/text_spec.lua6
-rw-r--r--test/functional/lua/thread_spec.lua14
-rw-r--r--test/functional/lua/ui_event_spec.lua18
-rw-r--r--test/functional/lua/ui_spec.lua14
-rw-r--r--test/functional/lua/uri_spec.lua8
-rw-r--r--test/functional/lua/version_spec.lua10
-rw-r--r--test/functional/lua/vim_spec.lua39
-rw-r--r--test/functional/lua/watch_spec.lua10
-rw-r--r--test/functional/lua/xdiff_spec.lua8
-rw-r--r--test/functional/options/autochdir_spec.lua14
-rw-r--r--test/functional/options/chars_spec.lua14
-rw-r--r--test/functional/options/cursorbind_spec.lua11
-rw-r--r--test/functional/options/defaults_spec.lua32
-rw-r--r--test/functional/options/keymap_spec.lua12
-rw-r--r--test/functional/options/modified_spec.lua8
-rw-r--r--test/functional/options/mousescroll_spec.lua20
-rw-r--r--test/functional/options/num_options_spec.lua6
-rw-r--r--test/functional/options/shortmess_spec.lua12
-rw-r--r--test/functional/options/tabstop_spec.lua8
-rw-r--r--test/functional/options/winfixbuf_spec.lua7
-rw-r--r--test/functional/plugin/ccomplete_spec.lua12
-rw-r--r--test/functional/plugin/cfilter_spec.lua10
-rw-r--r--test/functional/plugin/editorconfig_spec.lua20
-rw-r--r--test/functional/plugin/health_spec.lua35
-rw-r--r--test/functional/plugin/lsp/codelens_spec.lua9
-rw-r--r--test/functional/plugin/lsp/completion_spec.lua8
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua8
-rw-r--r--test/functional/plugin/lsp/handler_spec.lua5
-rw-r--r--test/functional/plugin/lsp/incremental_sync_spec.lua11
-rw-r--r--test/functional/plugin/lsp/inlay_hint_spec.lua11
-rw-r--r--test/functional/plugin/lsp/semantic_tokens_spec.lua17
-rw-r--r--test/functional/plugin/lsp/snippet_spec.lua10
-rw-r--r--test/functional/plugin/lsp/testutil.lua12
-rw-r--r--test/functional/plugin/lsp/utils_spec.lua11
-rw-r--r--test/functional/plugin/lsp_spec.lua30
-rw-r--r--test/functional/plugin/man_spec.lua14
-rw-r--r--test/functional/plugin/matchparen_spec.lua11
-rw-r--r--test/functional/plugin/msgpack_spec.lua14
-rw-r--r--test/functional/plugin/shada_spec.lua10
-rw-r--r--test/functional/plugin/tohtml_spec.lua15
-rw-r--r--test/functional/plugin/tutor_spec.lua10
-rw-r--r--test/functional/plugin/vim_syntax_spec.lua11
-rw-r--r--test/functional/preload.lua5
-rw-r--r--test/functional/provider/clipboard_spec.lua12
-rw-r--r--test/functional/provider/define_spec.lua16
-rw-r--r--test/functional/provider/nodejs_spec.lua12
-rw-r--r--test/functional/provider/perl_spec.lua20
-rw-r--r--test/functional/provider/provider_spec.lua8
-rw-r--r--test/functional/provider/python3_spec.lua22
-rw-r--r--test/functional/provider/ruby_spec.lua27
-rw-r--r--test/functional/script/luacats_grammar_spec.lua3
-rw-r--r--test/functional/script/luacats_parser_spec.lua3
-rw-r--r--test/functional/script/text_utils_spec.lua8
-rw-r--r--test/functional/shada/buffers_spec.lua10
-rw-r--r--test/functional/shada/compatibility_spec.lua9
-rw-r--r--test/functional/shada/errors_spec.lua7
-rw-r--r--test/functional/shada/history_spec.lua12
-rw-r--r--test/functional/shada/marks_spec.lua18
-rw-r--r--test/functional/shada/merging_spec.lua12
-rw-r--r--test/functional/shada/registers_spec.lua9
-rw-r--r--test/functional/shada/shada_spec.lua15
-rw-r--r--test/functional/shada/testutil.lua10
-rw-r--r--test/functional/shada/variables_spec.lua9
-rw-r--r--test/functional/terminal/altscreen_spec.lua8
-rw-r--r--test/functional/terminal/api_spec.lua12
-rw-r--r--test/functional/terminal/buffer_spec.lua28
-rw-r--r--test/functional/terminal/channel_spec.lua22
-rw-r--r--test/functional/terminal/cursor_spec.lua14
-rw-r--r--test/functional/terminal/edit_spec.lua14
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua20
-rw-r--r--test/functional/terminal/highlight_spec.lua16
-rw-r--r--test/functional/terminal/mouse_spec.lua8
-rw-r--r--test/functional/terminal/scrollback_spec.lua20
-rw-r--r--test/functional/terminal/testutil.lua11
-rw-r--r--test/functional/terminal/tui_spec.lua44
-rw-r--r--test/functional/terminal/window_spec.lua12
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua18
-rw-r--r--test/functional/testnvim.lua (renamed from test/functional/testutil.lua)84
-rw-r--r--test/functional/treesitter/fold_spec.lua18
-rw-r--r--test/functional/treesitter/highlight_spec.lua19
-rw-r--r--test/functional/treesitter/inspect_tree_spec.lua14
-rw-r--r--test/functional/treesitter/language_spec.lua11
-rw-r--r--test/functional/treesitter/node_spec.lua11
-rw-r--r--test/functional/treesitter/parser_spec.lua21
-rw-r--r--test/functional/treesitter/query_spec.lua17
-rw-r--r--test/functional/treesitter/utils_spec.lua9
-rw-r--r--test/functional/ui/bufhl_spec.lua9
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua17
-rw-r--r--test/functional/ui/cmdline_spec.lua20
-rw-r--r--test/functional/ui/cursor_spec.lua18
-rw-r--r--test/functional/ui/decorations_spec.lua33
-rw-r--r--test/functional/ui/diff_spec.lua15
-rw-r--r--test/functional/ui/embed_spec.lua32
-rw-r--r--test/functional/ui/float_spec.lua40
-rw-r--r--test/functional/ui/fold_spec.lua20
-rw-r--r--test/functional/ui/highlight_spec.lua20
-rw-r--r--test/functional/ui/hlstate_spec.lua21
-rw-r--r--test/functional/ui/inccommand_spec.lua28
-rw-r--r--test/functional/ui/inccommand_user_spec.lua18
-rw-r--r--test/functional/ui/input_spec.lua24
-rw-r--r--test/functional/ui/linematch_spec.lua23
-rw-r--r--test/functional/ui/messages_spec.lua38
-rw-r--r--test/functional/ui/mode_spec.lua7
-rw-r--r--test/functional/ui/mouse_spec.lua22
-rw-r--r--test/functional/ui/multibyte_spec.lua18
-rw-r--r--test/functional/ui/multigrid_spec.lua16
-rw-r--r--test/functional/ui/options_spec.lua10
-rw-r--r--test/functional/ui/output_spec.lua27
-rw-r--r--test/functional/ui/popupmenu_spec.lua24
-rw-r--r--test/functional/ui/quickfix_spec.lua7
-rw-r--r--test/functional/ui/screen.lua10
-rw-r--r--test/functional/ui/screen_basic_spec.lua16
-rw-r--r--test/functional/ui/searchhl_spec.lua16
-rw-r--r--test/functional/ui/sign_spec.lua8
-rw-r--r--test/functional/ui/spell_spec.lua14
-rw-r--r--test/functional/ui/statuscolumn_spec.lua20
-rw-r--r--test/functional/ui/statusline_spec.lua22
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua12
-rw-r--r--test/functional/ui/tabline_spec.lua12
-rw-r--r--test/functional/ui/title_spec.lua18
-rw-r--r--test/functional/ui/wildmode_spec.lua14
-rw-r--r--test/functional/ui/winbar_spec.lua18
-rw-r--r--test/functional/vimscript/api_functions_spec.lua18
-rw-r--r--test/functional/vimscript/buf_functions_spec.lua17
-rw-r--r--test/functional/vimscript/changedtick_spec.lua19
-rw-r--r--test/functional/vimscript/container_functions_spec.lua9
-rw-r--r--test/functional/vimscript/ctx_functions_spec.lua21
-rw-r--r--test/functional/vimscript/environ_spec.lua20
-rw-r--r--test/functional/vimscript/errorlist_spec.lua19
-rw-r--r--test/functional/vimscript/eval_spec.lua37
-rw-r--r--test/functional/vimscript/executable_spec.lua10
-rw-r--r--test/functional/vimscript/execute_spec.lua20
-rw-r--r--test/functional/vimscript/exepath_spec.lua14
-rw-r--r--test/functional/vimscript/fnamemodify_spec.lua16
-rw-r--r--test/functional/vimscript/functions_spec.lua7
-rw-r--r--test/functional/vimscript/getline_spec.lua9
-rw-r--r--test/functional/vimscript/glob_spec.lua6
-rw-r--r--test/functional/vimscript/has_spec.lua12
-rw-r--r--test/functional/vimscript/hostname_spec.lua8
-rw-r--r--test/functional/vimscript/input_spec.lua17
-rw-r--r--test/functional/vimscript/json_functions_spec.lua18
-rw-r--r--test/functional/vimscript/lang_spec.lua8
-rw-r--r--test/functional/vimscript/let_spec.lua21
-rw-r--r--test/functional/vimscript/map_functions_spec.lua25
-rw-r--r--test/functional/vimscript/match_functions_spec.lua11
-rw-r--r--test/functional/vimscript/minmax_functions_spec.lua11
-rw-r--r--test/functional/vimscript/modeline_spec.lua8
-rw-r--r--test/functional/vimscript/msgpack_functions_spec.lua20
-rw-r--r--test/functional/vimscript/null_spec.lua13
-rw-r--r--test/functional/vimscript/operators_spec.lua8
-rw-r--r--test/functional/vimscript/printf_spec.lua13
-rw-r--r--test/functional/vimscript/reltime_spec.lua8
-rw-r--r--test/functional/vimscript/screenchar_spec.lua8
-rw-r--r--test/functional/vimscript/screenpos_spec.lua10
-rw-r--r--test/functional/vimscript/server_spec.lua24
-rw-r--r--test/functional/vimscript/setpos_spec.lua18
-rw-r--r--test/functional/vimscript/sort_spec.lua15
-rw-r--r--test/functional/vimscript/special_vars_spec.lua16
-rw-r--r--test/functional/vimscript/state_spec.lua16
-rw-r--r--test/functional/vimscript/string_spec.lua18
-rw-r--r--test/functional/vimscript/system_spec.lua42
-rw-r--r--test/functional/vimscript/timer_spec.lua16
-rw-r--r--test/functional/vimscript/uniq_spec.lua9
-rw-r--r--test/functional/vimscript/vvar_event_spec.lua8
-rw-r--r--test/functional/vimscript/wait_spec.lua22
-rw-r--r--test/functional/vimscript/writefile_spec.lua13
-rw-r--r--test/old/testdir/load.vim2
-rw-r--r--test/testutil.lua53
444 files changed, 3459 insertions, 3131 deletions
diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt
index a89c1b35b6..b9e1e68dbb 100644
--- a/runtime/doc/dev_tools.txt
+++ b/runtime/doc/dev_tools.txt
@@ -87,9 +87,8 @@ Then, in another terminal:
>bash
gdb build/bin/nvim
target remote localhost:7777
-<
-- See also test/functional/testutil.lua https://github.com/neovim/neovim/blob/3098b18a2b63a841351f6d5e3697cb69db3035ef/test/functional/testutil.lua#L38-L44.
+-- See `nvim_argv` in https://github.com/neovim/neovim/blob/master/test/functional/testnvim.lua.
USING LLDB TO STEP THROUGH UNIT TESTS ~
diff --git a/scripts/legacy2luatest.pl b/scripts/legacy2luatest.pl
deleted file mode 100755
index 84a8889c82..0000000000
--- a/scripts/legacy2luatest.pl
+++ /dev/null
@@ -1,300 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use 5.010;
-use autodie;
-
-use File::Basename;
-use File::Spec::Functions;
-
-sub read_in_file {
- my $in_file = $_[0];
-
- # Will contain lines before first STARTTEST
- # as Lua comments.
- my @description_lines = ();
-
- # Will contain alternating blocks of lines of textual input
- # (text between ENDTEST and EOF/next STARTTEST) and test commands
- # (commands between STARTTEST and ENDTEST) as Lua code.
- my @test_body_lines = ();
-
- # Will contain current command block, i.e. lines
- # between STARTTEST and ENDTEST.
- my @command_lines = ();
-
- # Will contain current input block, i.e. lines
- # between ENDTEST and STARTTEST.
- my @input_lines = ();
-
- open my $in_file_handle, '<', $in_file;
-
- use constant EMIT_DESCRIPTION => 0;
- use constant EMIT_COMMAND => 1;
- use constant EMIT_INPUT => 2;
-
- # Push lines from current input and
- # command blocks into @test_body_lines
- # in the correct order.
- sub end_input {
- my $input_lines = $_[0];
- my $command_lines = $_[1];
- my $test_body_lines = $_[2];
-
- # If there are input lines, wrap with an `insert`
- # command and add before the previous command block.
- if (@{$input_lines}) {
- my $last_input_line = pop @{$input_lines};
- unshift @{$command_lines}, '';
- unshift @{$command_lines}, $last_input_line . ']=])';
- unshift @{$command_lines}, @{$input_lines};
- unshift @{$command_lines}, "insert([=[";
-
- @{$input_lines} = ();
- }
-
- # Output remaining command lines.
- push @{$test_body_lines}, @{$command_lines};
- @{$command_lines} = ();
- }
-
- sub format_comment {
- # Handle empty comments.
- if (/^$/) {
- return '';
- }
-
- # Capitalize first character and emit as Lua comment.
- my $comment = '-- ' . ucfirst $_;
-
- # Add trailing dot if not already there.
- $comment .= '.' unless $comment =~ /\.$/;
-
- return $comment;
- }
-
- my %states = (
- # Add test description to @description_lines.
- EMIT_DESCRIPTION() => sub {
- if (/^STARTTEST/) {
- return EMIT_COMMAND;
- }
-
- # If not an empty line, emit as Lua comment.
- if (!/^$/) {
- # Remove modeline
- s/vim:.*set f\w+=vim//g;
- # Remove trailing ":"
- s/\s*:\s*$//g;
- push @description_lines, '-- ' . $_;
- }
-
- return EMIT_DESCRIPTION;
- },
- # Add test commands to @command_lines.
- EMIT_COMMAND() => sub {
- if (/^ENDTEST/) {
- return EMIT_INPUT;
- }
-
- # If line starts with ':"', emit a comment.
- if (/^:"/) {
- # Remove Vim comment prefix.
- s/^:"\s*//;
-
- push @command_lines, format_comment $_;
-
- return EMIT_COMMAND;
- }
-
- # Extract possible inline comment.
- if (/^[^"]*"[^"]*$/) {
- # Remove command part and prepended whitespace.
- s/^(.*?)\s*"\s*//;
-
- push @command_lines, format_comment $_;
-
- # Set implicit variable to command without comment.
- $_ = $1;
- }
-
- # Only continue if remaining command is not empty.
- if (!/^:?\s*$/) {
- # Replace terminal escape characters with <esc>.
- s/\e/<esc>/g;
-
- my $startstr = "'";
- my $endstr = "'";
-
- # If line contains single quotes or backslashes, use double
- # square brackets to wrap string.
- if (/'/ || /\\/) {
- # If the line contains a closing square bracket,
- # wrap it with [=[...]=].
- if (/\]/) {
- $startstr = '[=[';
- $endstr = ']=]';
- } else {
- $startstr = '[[';
- $endstr = ']]';
- }
- }
-
- # Emit 'feed' if not a search ('/') or ex (':') command.
- if (!/^\// && !/^:/) {
- # If command does not end with <esc>, insert trailing <cr>.
- my $command = 'feed(' . $startstr . $_;
- $command .= '<cr>' unless /<esc>$/;
- $command .= $endstr . ')';
-
- push @command_lines, $command;
- } else {
- # Remove prepending ':'.
- s/^://;
- push @command_lines, 'execute(' . $startstr . $_ . $endstr . ')';
- }
- }
-
- return EMIT_COMMAND;
- },
- # Add input to @input_lines.
- EMIT_INPUT() => sub {
- if (/^STARTTEST/) {
- end_input \@input_lines, \@command_lines, \@test_body_lines;
- return EMIT_COMMAND;
- }
-
- # Skip initial lines if they are empty.
- if (@input_lines or !/^$/) {
- push @input_lines, ' ' . $_;
- }
- return EMIT_INPUT;
- },
- );
-
- my $state = EMIT_DESCRIPTION;
-
- while (<$in_file_handle>) {
- # Remove trailing newline character and process line.
- chomp;
- $state = $states{$state}->($_);
- }
-
- # If not all lines have been processed yet,
- # do it now.
- end_input \@input_lines, \@command_lines, \@test_body_lines;
-
- close $in_file_handle;
-
- return (\@description_lines, \@test_body_lines);
-}
-
-sub read_ok_file {
- my $ok_file = $_[0];
- my @assertions = ();
-
- if (-f $ok_file) {
- push @assertions, '';
- push @assertions, "-- Assert buffer contents.";
- push @assertions, "expect([=[";
-
- open my $ok_file_handle, '<', $ok_file;
-
- while (<$ok_file_handle>) {
- # Remove trailing newline character and process line.
- chomp;
- push @assertions, ' ' . $_;
- }
-
- close $ok_file_handle;
-
- $assertions[-1] .= "]=])";
- }
-
- return \@assertions;
-}
-
-my $legacy_testfile = $ARGV[0];
-my $out_dir = $ARGV[1];
-
-if ($#ARGV != 1) {
- say "Convert a legacy Vim test to a Neovim lua spec.";
- say '';
- say "Usage: $0 legacy-testfile output-directory";
- say '';
- say "legacy-testfile: Path to .in or .ok file.";
- say "output-directory: Directory where Lua spec will be saved to.";
- say '';
- say "Note: Only works reliably for fairly simple tests.";
- say " Manual adjustments to generated spec files are required.";
- exit 1;
-}
-
-my @legacy_suffixes = ('.in', '.ok');
-my ($base_name, $base_path, $suffix) = fileparse($legacy_testfile, @legacy_suffixes);
-my $in_file = catfile($base_path, $base_name . '.in');
-my $ok_file = catfile($base_path, $base_name . '.ok');
-
-# Remove leading 'test'.
-my $test_name = $base_name;
-$test_name =~ s/^test_?//;
-
-my $spec_file = do {
- if ($test_name =~ /^([0-9]+)/) {
- catfile($out_dir, sprintf('%03d', $1) . '_spec.lua')
- } else {
- catfile($out_dir, $test_name . '_spec.lua')
- }
-};
-
-if (! -f $in_file) {
- say "Test input file $in_file not found.";
- exit 2;
-}
-
-if (! -d $out_dir) {
- say "Output directory $out_dir does not exist.";
- exit 3;
-}
-
-if (-f $spec_file) {
- say "Output file $spec_file already exists.";
- print "Overwrite (Y/n)? ";
- my $input = <STDIN>;
- chomp($input);
- unless ($input =~ /^y|Y/) {
- say "Aborting.";
- exit 4;
- }
-}
-
-# Read .in and .ok files.
-my ($description_lines, $test_body_lines) = read_in_file $in_file;
-my $assertion_lines = read_ok_file $ok_file;
-
-# Append assertions to test body.
-push @{$test_body_lines}, @{$assertion_lines} if @{$assertion_lines};
-
-# Write spec file.
-open my $spec_file_handle, ">", $spec_file;
-
-print $spec_file_handle <<"EOS";
-@{[join "\n", @{$description_lines}]}
-
-local t = require('test.functional.testutil')
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, execute, expect = t.clear, t.execute, t.expect
-
-describe('$test_name', function()
- before_each(clear)
-
- it('is working', function()
-@{[join "\n", map { /^$/ ? '' : ' ' . $_ } @{$test_body_lines}]}
- end)
-end)
-EOS
-
-close $spec_file_handle;
-
-say "Written to $spec_file."
diff --git a/test/README.md b/test/README.md
index 3c8a4a60a6..45b3322305 100644
--- a/test/README.md
+++ b/test/README.md
@@ -37,6 +37,7 @@ Layout
- `/test/benchmark` : benchmarks
- `/test/functional` : functional tests
- `/test/unit` : unit tests
+- `/test/old/testdir` : old tests (from Vim)
- `/test/config` : contains `*.in` files which are transformed into `*.lua`
files using `configure_file` CMake command: this is for accessing CMake
variables in lua tests.
@@ -44,11 +45,13 @@ Layout
parser: normally used to make macros not accessible via this mechanism
accessible the other way.
- `/test/*/preload.lua` : modules preloaded by busted `--helper` option
-- `/test/**/testutil.lua` : common utility functions for test code
+- `/test/**/testutil.lua` : common utility functions in the context of the test
+ runner
+- `/test/**/testnvim.lua` : common utility functions in the context of the
+ test session (RPC channel to the Nvim child process created by clear() for each test)
- `/test/*/**/*_spec.lua` : actual tests. Files that do not end with
`_spec.lua` are libraries like `/test/**/testutil.lua`, except that they have
some common topic.
-- `/test/old/testdir` : old tests (from Vim)
Running tests
@@ -119,7 +122,7 @@ Debugging tests
If `$VALGRIND` is also set it will pass `--vgdb=yes` to valgrind instead of
starting gdbserver directly.
- See [test/functional/testutil.lua](https://github.com/neovim/neovim/blob/9cadbf1d36b63f53f0de48c8c5ff6c752ff05d70/test/functional/testutil.lua#L52-L69) for details.
+ See `nvim_argv` in https://github.com/neovim/neovim/blob/master/test/functional/testnvim.lua.
- Hanging tests can happen due to unexpected "press-enter" prompts. The
default screen width is 50 columns. Commands that try to print lines longer
@@ -297,7 +300,7 @@ Number; !must be defined to function properly):
- `VALGRIND` (F) (D): makes nvim instances to be run under `valgrind`. Log
files are named `valgrind-%p.log` in this case. Note that non-empty valgrind
log may fail tests. Valgrind arguments may be seen in
- `/test/functional/testutil.lua`. May be used in conjunction with `GDB`.
+ `/test/functional/testnvim.lua`. May be used in conjunction with `GDB`.
- `VALGRIND_LOG` (F) (S): overrides valgrind log file name used for `VALGRIND`.
diff --git a/test/benchmark/autocmd_spec.lua b/test/benchmark/autocmd_spec.lua
index 19660723e0..af5fa1c258 100644
--- a/test/benchmark/autocmd_spec.lua
+++ b/test/benchmark/autocmd_spec.lua
@@ -1,7 +1,7 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local clear = n.clear
+local exec_lua = n.exec_lua
local N = 7500
diff --git a/test/benchmark/bench_regexp_spec.lua b/test/benchmark/bench_regexp_spec.lua
index 4a2d01130a..2c2b8dc359 100644
--- a/test/benchmark/bench_regexp_spec.lua
+++ b/test/benchmark/bench_regexp_spec.lua
@@ -1,8 +1,9 @@
-- Test for benchmarking the RE engine.
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, command = t.clear, t.command
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, command = n.clear, n.command
-- Temporary file for gathering benchmarking results for each regexp engine.
local result_file = 'benchmark.out'
diff --git a/test/benchmark/preload.lua b/test/benchmark/preload.lua
index 9e24b5cdf1..a7b815ddf8 100644
--- a/test/benchmark/preload.lua
+++ b/test/benchmark/preload.lua
@@ -1,4 +1,4 @@
-- Modules loaded here will not be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation. See issue #62
-- for more information about this.
-local t = require('test.functional.testutil')
+local n = require('test.functional.testnvim')
diff --git a/test/benchmark/screenpos_spec.lua b/test/benchmark/screenpos_spec.lua
index a05c8909f5..d9d4a70628 100644
--- a/test/benchmark/screenpos_spec.lua
+++ b/test/benchmark/screenpos_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local api = n.api
+
local function rand_utf8(count, seed)
math.randomseed(seed)
local symbols = { 'i', 'À', 'Ⱡ', '𐀀' }
@@ -119,7 +121,7 @@ end
local function benchmarks(benchmark_results)
describe('screenpos() perf', function()
- before_each(t.clear)
+ before_each(n.clear)
-- no breakindent
for li, lines_type in ipairs(benchmark_lines) do
@@ -134,7 +136,7 @@ local function benchmarks(benchmark_results)
screen:attach()
api.nvim_buf_set_lines(0, 0, 1, false, lines)
-- for smaller screen expect (last line always different, first line same as others)
- t.feed('G$')
+ n.feed('G$')
screen:expect(result.screen)
benchmark(lines, result.value)
end)
@@ -153,9 +155,9 @@ local function benchmarks(benchmark_results)
local screen = Screen.new(width, height + 1)
screen:attach()
api.nvim_buf_set_lines(0, 0, 1, false, lines)
- t.command('set breakindent')
+ n.command('set breakindent')
-- for smaller screen expect (last line always different, first line same as others)
- t.feed('G$')
+ n.feed('G$')
screen:expect(result.screen)
benchmark(lines, result.value)
end)
diff --git a/test/benchmark/treesitter_spec.lua b/test/benchmark/treesitter_spec.lua
index 74c2e9ec8e..b13b0fd9da 100644
--- a/test/benchmark/treesitter_spec.lua
+++ b/test/benchmark/treesitter_spec.lua
@@ -1,7 +1,7 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local clear = n.clear
+local exec_lua = n.exec_lua
describe('treesitter perf', function()
setup(function()
@@ -9,7 +9,7 @@ describe('treesitter perf', function()
end)
it('can handle large folds', function()
- t.command 'edit ./src/nvim/eval.c'
+ n.command 'edit ./src/nvim/eval.c'
exec_lua [[
local parser = vim.treesitter.get_parser(0, "c", {})
vim.treesitter.highlighter.new(parser)
diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua
index d2ec3a576c..3f9883f43f 100644
--- a/test/functional/api/autocmd_spec.lua
+++ b/test/functional/api/autocmd_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
local neq = t.neq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local matches = t.matches
-local api = t.api
-local source = t.source
+local api = n.api
+local source = n.source
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index 12b2c43158..cf69958fd8 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -1,21 +1,23 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+
+local clear = n.clear
local eq = t.eq
local ok = t.ok
-local describe_lua_and_rpc = t.describe_lua_and_rpc(describe)
-local api = t.api
-local fn = t.fn
-local request = t.request
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local feed_command = t.feed_command
-local insert = t.insert
+local describe_lua_and_rpc = n.describe_lua_and_rpc(describe)
+local api = n.api
+local fn = n.fn
+local request = n.request
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local feed_command = n.feed_command
+local insert = n.insert
local NIL = vim.NIL
-local command = t.command
-local feed = t.feed
+local command = n.command
+local feed = n.feed
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('api/buf', function()
before_each(clear)
@@ -2066,7 +2068,7 @@ describe('api/buf', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with non-current buffer', function()
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 494bc4495b..e030b45396 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq, ok = t.eq, t.ok
-local fn = t.fn
-local api = t.api
-local command, eval, next_msg = t.command, t.eval, t.next_msg
-local nvim_prog = t.nvim_prog
+local fn = n.fn
+local api = n.api
+local command, eval, next_msg = n.command, n.eval, n.next_msg
+local nvim_prog = n.nvim_prog
local pcall_err = t.pcall_err
local sleep = vim.uv.sleep
local write_file = t.write_file
@@ -511,11 +513,11 @@ describe('API: buffer events:', function()
-- create several new sessions, in addition to our main API
local sessions = {}
- local pipe = t.new_pipename()
+ local pipe = n.new_pipename()
eval("serverstart('" .. pipe .. "')")
- sessions[1] = t.connect(pipe)
- sessions[2] = t.connect(pipe)
- sessions[3] = t.connect(pipe)
+ sessions[1] = n.connect(pipe)
+ sessions[2] = n.connect(pipe)
+ sessions[3] = n.connect(pipe)
local function request(sessionnr, method, ...)
local status, rv = sessions[sessionnr]:request(method, ...)
@@ -814,7 +816,7 @@ describe('API: buffer events:', function()
clear()
sleep(250)
-- response
- eq(true, t.request('nvim_buf_attach', 0, false, {}))
+ eq(true, n.request('nvim_buf_attach', 0, false, {}))
-- notification
eq({
[1] = 'notification',
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index 6c51fac178..a16c6a88e3 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local NIL = vim.NIL
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local api = t.api
+local api = n.api
local matches = t.matches
-local source = t.source
+local source = n.source
local pcall_err = t.pcall_err
-local exec_lua = t.exec_lua
-local assert_alive = t.assert_alive
-local feed = t.feed
-local fn = t.fn
+local exec_lua = n.exec_lua
+local assert_alive = n.assert_alive
+local feed = n.feed
+local fn = n.fn
describe('nvim_get_commands', function()
local cmd_dict = {
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index 82e7ad3988..70bdb050e5 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -1,20 +1,21 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local request = t.request
+local request = n.request
local eq = t.eq
local ok = t.ok
local pcall_err = t.pcall_err
-local insert = t.insert
-local feed = t.feed
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local api = t.api
-local assert_alive = t.assert_alive
+local insert = n.insert
+local feed = n.feed
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local api = n.api
+local assert_alive = n.assert_alive
local function expect(contents)
- return eq(contents, t.curbuf_contents())
+ return eq(contents, n.curbuf_contents())
end
local function set_extmark(ns_id, id, line, col, opts)
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 50e79f8860..dd0611f184 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local eq, eval = t.eq, t.eval
-local command = t.command
-local exec_capture = t.exec_capture
-local api = t.api
-local fn = t.fn
+
+local clear = n.clear
+local eq, eval = t.eq, n.eval
+local command = n.command
+local exec_capture = n.exec_capture
+local api = n.api
+local fn = n.fn
local pcall_err = t.pcall_err
local ok = t.ok
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('API: highlight', function()
clear()
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index f0ed04e88e..995711507f 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq, neq = t.eq, t.neq
-local exec_lua = t.exec_lua
-local exec = t.exec
-local feed = t.feed
-local fn = t.fn
-local api = t.api
+local exec_lua = n.exec_lua
+local exec = n.exec
+local feed = n.feed
+local fn = n.fn
+local api = n.api
local matches = t.matches
-local source = t.source
+local source = n.source
local pcall_err = t.pcall_err
local shallowcopy = t.shallowcopy
@@ -1146,7 +1147,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('no double-free when unmapping simplifiable lua mappings', function()
@@ -1170,13 +1171,13 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
feed('<C-I>\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap <C-I>'))
+ eq('\nNo mapping found', n.exec_capture('nmap <C-I>'))
end)
it('can set descriptions on mappings', function()
api.nvim_set_keymap('n', 'lhs', 'rhs', { desc = 'map description' })
eq(generate_mapargs('n', 'lhs', 'rhs', { desc = 'map description' }), get_mapargs('n', 'lhs'))
- eq('\nn lhs rhs\n map description', t.exec_capture('nmap lhs'))
+ eq('\nn lhs rhs\n map description', n.exec_capture('nmap lhs'))
end)
it('can define !-mode abbreviations with lua callbacks', function()
@@ -1331,7 +1332,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('does not crash when setting mapping in a non-existing buffer #13541', function()
pcall_err(api.nvim_buf_set_keymap, 100, '', 'lsh', 'irhs<Esc>', {})
- t.assert_alive()
+ n.assert_alive()
end)
it('can make lua mappings', function()
@@ -1426,7 +1427,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('no double-free when unmapping simplifiable lua mappings', function()
@@ -1450,6 +1451,6 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
feed('<C-I>\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap <C-I>'))
+ eq('\nNo mapping found', n.exec_capture('nmap <C-I>'))
end)
end)
diff --git a/test/functional/api/menu_spec.lua b/test/functional/api/menu_spec.lua
index 2e6fdd6551..76eef164c9 100644
--- a/test/functional/api/menu_spec.lua
+++ b/test/functional/api/menu_spec.lua
@@ -1,9 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+local clear = n.clear
+local command = n.command
+local feed = n.feed
describe('update_menu notification', function()
local screen
diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua
index 1b090aa30d..d2dd655b17 100644
--- a/test/functional/api/proc_spec.lua
+++ b/test/functional/api/proc_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local fn = t.fn
+local fn = n.fn
local neq = t.neq
-local nvim_argv = t.nvim_argv
-local request = t.request
+local nvim_argv = n.nvim_argv
+local request = n.request
local retry = t.retry
local NIL = vim.NIL
local is_os = t.is_os
diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua
index fd7e596016..b8efbfbd0e 100644
--- a/test/functional/api/server_notifications_spec.lua
+++ b/test/functional/api/server_notifications_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local assert_log = t.assert_log
-local eq, clear, eval, command, next_msg = t.eq, t.clear, t.eval, t.command, t.next_msg
-local api = t.api
-local exec_lua = t.exec_lua
+local eq, clear, eval, command, next_msg = t.eq, n.clear, n.eval, n.command, n.next_msg
+local api = n.api
+local exec_lua = n.exec_lua
local retry = t.retry
-local assert_alive = t.assert_alive
-local check_close = t.check_close
+local assert_alive = n.assert_alive
+local check_close = n.check_close
local testlog = 'Xtest-server-notify-log'
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index 5385b23ec1..bdd340f6c6 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -1,17 +1,18 @@
-- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate
-- `rpcrequest` calls we need the client event loop to be running.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear, eval = t.clear, t.eval
-local eq, neq, run, stop = t.eq, t.neq, t.run, t.stop
-local nvim_prog, command, fn = t.nvim_prog, t.command, t.fn
-local source, next_msg = t.source, t.next_msg
+local clear, eval = n.clear, n.eval
+local eq, neq, run, stop = t.eq, t.neq, n.run, n.stop
+local nvim_prog, command, fn = n.nvim_prog, n.command, n.fn
+local source, next_msg = n.source, n.next_msg
local ok = t.ok
-local api = t.api
-local spawn, merge_args = t.spawn, t.merge_args
-local set_session = t.set_session
+local api = n.api
+local spawn, merge_args = n.spawn, n.merge_args
+local set_session = n.set_session
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('server -> client', function()
local cid
@@ -91,19 +92,19 @@ describe('server -> client', function()
local function on_request(method, args)
eq('rcall', method)
- local n = unpack(args) * 2
- if n <= 16 then
+ local _n = unpack(args) * 2
+ if _n <= 16 then
local cmd
- if n == 4 then
- cmd = 'let g:result2 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
- elseif n == 8 then
- cmd = 'let g:result3 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
- elseif n == 16 then
- cmd = 'let g:result4 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
+ if _n == 4 then
+ cmd = 'let g:result2 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
+ elseif _n == 8 then
+ cmd = 'let g:result3 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
+ elseif _n == 16 then
+ cmd = 'let g:result4 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
end
command(cmd)
end
- return n
+ return _n
end
run(on_request, nil, on_setup)
end)
@@ -280,7 +281,7 @@ describe('server -> client', function()
end)
describe('connecting to another (peer) nvim', function()
- local nvim_argv = merge_args(t.nvim_argv, { '--headless' })
+ local nvim_argv = merge_args(n.nvim_argv, { '--headless' })
local function connect_test(server, mode, address)
local serverpid = fn.getpid()
local client = spawn(nvim_argv, false, nil, true)
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index 328e3aa653..74858475c8 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
-local clear, eq, ok = t.clear, t.eq, t.ok
-local exec = t.exec
-local feed = t.feed
-local api = t.api
-local fn = t.fn
-local request = t.request
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, ok = n.clear, t.eq, t.ok
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local fn = n.fn
+local request = n.request
local NIL = vim.NIL
local pcall_err = t.pcall_err
-local command = t.command
+local command = n.command
describe('api/tabpage', function()
before_each(clear)
diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua
index 36fa71f2ec..2145db7f8a 100644
--- a/test/functional/api/ui_spec.lua
+++ b/test/functional/api/ui_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local exec = t.exec
-local feed = t.feed
-local api = t.api
-local request = t.request
+local eval = n.eval
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local request = n.request
local pcall_err = t.pcall_err
describe('nvim_ui_attach()', function()
diff --git a/test/functional/api/version_spec.lua b/test/functional/api/version_spec.lua
index b57f67369e..5dad9978b7 100644
--- a/test/functional/api/version_spec.lua
+++ b/test/functional/api/version_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, fn, eq = t.clear, t.fn, t.eq
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, fn, eq = n.clear, n.fn, t.eq
+local api = n.api
local function read_mpack_file(fname)
local fd = io.open(fname, 'rb')
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index c412773482..2d3871a37d 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,36 +1,37 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local uv = vim.uv
local fmt = string.format
local dedent = t.dedent
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local NIL = vim.NIL
-local clear, eq, neq = t.clear, t.eq, t.neq
-local command = t.command
-local command_output = t.api.nvim_command_output
-local exec = t.exec
-local exec_capture = t.exec_capture
-local eval = t.eval
-local expect = t.expect
-local fn = t.fn
-local api = t.api
+local clear, eq, neq = n.clear, t.eq, t.neq
+local command = n.command
+local command_output = n.api.nvim_command_output
+local exec = n.exec
+local exec_capture = n.exec_capture
+local eval = n.eval
+local expect = n.expect
+local fn = n.fn
+local api = n.api
local matches = t.matches
local pesc = vim.pesc
-local mkdir_p = t.mkdir_p
-local ok, nvim_async, feed = t.ok, t.nvim_async, t.feed
-local async_meths = t.async_meths
+local mkdir_p = n.mkdir_p
+local ok, nvim_async, feed = t.ok, n.nvim_async, n.feed
+local async_meths = n.async_meths
local is_os = t.is_os
-local parse_context = t.parse_context
-local request = t.request
-local rmdir = t.rmdir
-local source = t.source
-local next_msg = t.next_msg
+local parse_context = n.parse_context
+local request = n.request
+local rmdir = n.rmdir
+local source = n.source
+local next_msg = n.next_msg
local tmpname = t.tmpname
local write_file = t.write_file
-local exec_lua = t.exec_lua
-local exc_exec = t.exc_exec
-local insert = t.insert
+local exec_lua = n.exec_lua
+local exc_exec = n.exc_exec
+local insert = n.insert
local skip = t.skip
local pcall_err = t.pcall_err
@@ -722,12 +723,12 @@ describe('API', function()
end)
after_each(function()
- t.rmdir('Xtestdir')
+ n.rmdir('Xtestdir')
end)
it('works', function()
api.nvim_set_current_dir('Xtestdir')
- eq(start_dir .. t.get_pathsep() .. 'Xtestdir', fn.getcwd())
+ eq(start_dir .. n.get_pathsep() .. 'Xtestdir', fn.getcwd())
end)
it('sets previous directory', function()
@@ -1487,7 +1488,7 @@ describe('API', function()
eq(NIL, api.nvim_get_var('Unknown_script_func'))
-- Check if autoload works properly
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = 'Xhome' .. pathsep .. 'Xconfig'
local xdata = 'Xhome' .. pathsep .. 'Xdata'
local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep)
@@ -1971,7 +1972,7 @@ describe('API', function()
describe('RPC (K_EVENT)', function()
it('does not complete ("interrupt") normal-mode operator-pending #6166', function()
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('gg')
@@ -2008,7 +2009,7 @@ describe('API', function()
it('does not complete ("interrupt") normal-mode map-pending #6166', function()
command("nnoremap dd :let g:foo='it worked...'<CR>")
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('gg')
@@ -2020,13 +2021,13 @@ describe('API', function()
expect([[
FIRST LINE
SECOND LINE]])
- eq('it worked...', t.eval('g:foo'))
+ eq('it worked...', n.eval('g:foo'))
end)
it('does not complete ("interrupt") insert-mode map-pending #6166', function()
command('inoremap xx foo')
command('set timeoutlen=9999')
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('ix')
@@ -2173,32 +2174,32 @@ describe('API', function()
describe('nvim_replace_termcodes', function()
it('escapes K_SPECIAL as K_SPECIAL KS_SPECIAL KE_FILLER', function()
- eq('\128\254X', t.api.nvim_replace_termcodes('\128', true, true, true))
+ eq('\128\254X', n.api.nvim_replace_termcodes('\128', true, true, true))
end)
it('leaves non-K_SPECIAL string unchanged', function()
- eq('abc', t.api.nvim_replace_termcodes('abc', true, true, true))
+ eq('abc', n.api.nvim_replace_termcodes('abc', true, true, true))
end)
it('converts <expressions>', function()
- eq('\\', t.api.nvim_replace_termcodes('<Leader>', true, true, true))
+ eq('\\', n.api.nvim_replace_termcodes('<Leader>', true, true, true))
end)
it('converts <LeftMouse> to K_SPECIAL KS_EXTRA KE_LEFTMOUSE', function()
-- K_SPECIAL KS_EXTRA KE_LEFTMOUSE
-- 0x80 0xfd 0x2c
-- 128 253 44
- eq('\128\253\44', t.api.nvim_replace_termcodes('<LeftMouse>', true, true, true))
+ eq('\128\253\44', n.api.nvim_replace_termcodes('<LeftMouse>', true, true, true))
end)
it('converts keycodes', function()
- eq('\nx\27x\rx<x', t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true))
+ eq('\nx\27x\rx<x', n.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true))
end)
it('does not convert keycodes if special=false', function()
eq(
'<NL>x<Esc>x<CR>x<lt>x',
- t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false)
+ n.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false)
)
end)
@@ -2227,18 +2228,18 @@ describe('API', function()
api.nvim_feedkeys(':let x1="…"\n', '', true)
-- Both nvim_replace_termcodes and nvim_feedkeys escape \x80
- local inp = t.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true)
+ local inp = n.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true)
api.nvim_feedkeys(inp, '', true) -- escape_ks=true
-- nvim_feedkeys with K_SPECIAL escaping disabled
- inp = t.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true)
+ inp = n.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true)
api.nvim_feedkeys(inp, '', false) -- escape_ks=false
- t.stop()
+ n.stop()
end
-- spin the loop a bit
- t.run(nil, nil, on_setup)
+ n.run(nil, nil, on_setup)
eq('…', api.nvim_get_var('x1'))
-- Because of the double escaping this is neq
@@ -2381,7 +2382,7 @@ describe('API', function()
{0:~ }|*6
{1:very fail} |
]])
- t.poke_eventloop()
+ n.poke_eventloop()
-- shows up to &cmdheight lines
async_meths.nvim_err_write('more fail\ntoo fail\n')
@@ -2693,7 +2694,7 @@ describe('API', function()
describe('nvim_list_runtime_paths', function()
setup(function()
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
mkdir_p('Xtest' .. pathsep .. 'a')
mkdir_p('Xtest' .. pathsep .. 'b')
end)
@@ -3200,7 +3201,7 @@ describe('API', function()
end)
describe('nvim_get_runtime_file', function()
- local p = t.alter_slashes
+ local p = n.alter_slashes
it('can find files', function()
eq({}, api.nvim_get_runtime_file('bork.borkbork', false))
eq({}, api.nvim_get_runtime_file('bork.borkbork', true))
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 36966b68f5..636338cb2e 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -1,27 +1,29 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+
local clear, curbuf, curbuf_contents, curwin, eq, neq, matches, ok, feed, insert, eval =
- t.clear,
- t.api.nvim_get_current_buf,
- t.curbuf_contents,
- t.api.nvim_get_current_win,
+ n.clear,
+ n.api.nvim_get_current_buf,
+ n.curbuf_contents,
+ n.api.nvim_get_current_win,
t.eq,
t.neq,
t.matches,
t.ok,
- t.feed,
- t.insert,
- t.eval
-local poke_eventloop = t.poke_eventloop
-local exec = t.exec
-local exec_lua = t.exec_lua
-local fn = t.fn
-local request = t.request
+ n.feed,
+ n.insert,
+ n.eval
+local poke_eventloop = n.poke_eventloop
+local exec = n.exec
+local exec_lua = n.exec_lua
+local fn = n.fn
+local request = n.request
local NIL = vim.NIL
-local api = t.api
-local command = t.command
+local api = n.api
+local command = n.command
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('API/win', function()
before_each(clear)
@@ -136,7 +138,7 @@ describe('API/win', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with non-current window', function()
@@ -1370,7 +1372,7 @@ describe('API/win', function()
local tab1 = api.nvim_get_current_tabpage()
local tab1_win = api.nvim_get_current_win()
- t.command('tabnew')
+ n.command('tabnew')
local tab2 = api.nvim_get_current_tabpage()
local tab2_win = api.nvim_get_current_win()
@@ -1790,7 +1792,7 @@ describe('API/win', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with enter=false #15280', function()
diff --git a/test/functional/autocmd/autocmd_oldtest_spec.lua b/test/functional/autocmd/autocmd_oldtest_spec.lua
index e0df54e20e..1a3b723ac2 100644
--- a/test/functional/autocmd/autocmd_oldtest_spec.lua
+++ b/test/functional/autocmd/autocmd_oldtest_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local api = t.api
-local fn = t.fn
-local exec = t.exec
-local feed = t.feed
+local api = n.api
+local fn = n.fn
+local exec = n.exec
+local feed = n.feed
local assert_log = t.assert_log
-local check_close = t.check_close
+local check_close = n.check_close
local is_os = t.is_os
local testlog = 'Xtest_autocmd_oldtest_log'
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
index d5c4625b72..5e407a9986 100644
--- a/test/functional/autocmd/autocmd_spec.lua
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -1,24 +1,25 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_visible = t.assert_visible
-local assert_alive = t.assert_alive
+local assert_visible = n.assert_visible
+local assert_alive = n.assert_alive
local dedent = t.dedent
local eq = t.eq
local neq = t.neq
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
local matches = t.matches
-local api = t.api
+local api = n.api
local pcall_err = t.pcall_err
-local fn = t.fn
-local expect = t.expect
-local command = t.command
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
+local fn = n.fn
+local expect = n.expect
+local command = n.command
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
local retry = t.retry
-local source = t.source
+local source = n.source
describe('autocmd', function()
before_each(clear)
diff --git a/test/functional/autocmd/bufenter_spec.lua b/test/functional/autocmd/bufenter_spec.lua
index 7851ed5fe3..72e650cae4 100644
--- a/test/functional/autocmd/bufenter_spec.lua
+++ b/test/functional/autocmd/bufenter_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local request = t.request
-local source = t.source
+local eval = n.eval
+local request = n.request
+local source = n.source
describe('autocmd BufEnter', function()
before_each(clear)
@@ -33,7 +34,7 @@ describe('autocmd BufEnter', function()
end)
it('triggered by ":split normal|:help|:bw"', function()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
command('split normal')
command('wincmd j')
command('help')
diff --git a/test/functional/autocmd/bufmodifiedset_spec.lua b/test/functional/autocmd/bufmodifiedset_spec.lua
index 25d6adee21..fb8f160b05 100644
--- a/test/functional/autocmd/bufmodifiedset_spec.lua
+++ b/test/functional/autocmd/bufmodifiedset_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local source = t.source
-local request = t.request
+local eval = n.eval
+local source = n.source
+local request = n.request
describe('BufModified', function()
before_each(clear)
diff --git a/test/functional/autocmd/cmdline_spec.lua b/test/functional/autocmd/cmdline_spec.lua
index 84cd3f838f..ad3bc3576f 100644
--- a/test/functional/autocmd/cmdline_spec.lua
+++ b/test/functional/autocmd/cmdline_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local expect = t.expect
-local eval = t.eval
-local next_msg = t.next_msg
-local feed = t.feed
-local api = t.api
+local expect = n.expect
+local eval = n.eval
+local next_msg = n.next_msg
+local feed = n.feed
+local api = n.api
describe('cmdline autocommands', function()
local channel
diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua
index 788630308f..c2815be5c6 100644
--- a/test/functional/autocmd/cursorhold_spec.lua
+++ b/test/functional/autocmd/cursorhold_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local feed = t.feed
+local feed = n.feed
local retry = t.retry
-local exec = t.source
+local exec = n.source
local sleep = vim.uv.sleep
-local api = t.api
+local api = n.api
before_each(clear)
diff --git a/test/functional/autocmd/cursormoved_spec.lua b/test/functional/autocmd/cursormoved_spec.lua
index 58436dc4e7..2cf02e00f3 100644
--- a/test/functional/autocmd/cursormoved_spec.lua
+++ b/test/functional/autocmd/cursormoved_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local api = t.api
-local source = t.source
-local command = t.command
+local eval = n.eval
+local api = n.api
+local source = n.source
+local command = n.command
describe('CursorMoved', function()
before_each(clear)
diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua
index 2634b99ea4..24ac737b5b 100644
--- a/test/functional/autocmd/dirchanged_spec.lua
+++ b/test/functional/autocmd/dirchanged_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local request = t.request
+local eval = n.eval
+local request = n.request
local is_os = t.is_os
describe('autocmd DirChanged and DirChangedPre', function()
@@ -27,7 +28,7 @@ describe('autocmd DirChanged and DirChangedPre', function()
end)
teardown(function()
for _, dir in pairs(dirs) do
- t.rmdir(dir)
+ n.rmdir(dir)
end
end)
diff --git a/test/functional/autocmd/filetype_spec.lua b/test/functional/autocmd/filetype_spec.lua
index d1280e322f..91843c7910 100644
--- a/test/functional/autocmd/filetype_spec.lua
+++ b/test/functional/autocmd/filetype_spec.lua
@@ -1,14 +1,14 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local eval = t.eval
-local clear = t.clear
-local command = t.command
+local eval = n.eval
+local clear = n.clear
+local command = n.command
describe('autocmd FileType', function()
before_each(clear)
it('is triggered by :help only once', function()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
command('let g:foo = 0')
command('autocmd FileType help let g:foo = g:foo + 1')
command('help help')
diff --git a/test/functional/autocmd/focus_spec.lua b/test/functional/autocmd/focus_spec.lua
index acb7fed22e..5163b576db 100644
--- a/test/functional/autocmd/focus_spec.lua
+++ b/test/functional/autocmd/focus_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local tt = require('test.functional.terminal.testutil')
-local clear = t.clear
-local feed_command = t.feed_command
+
+local clear = n.clear
+local feed_command = n.feed_command
local feed_data = tt.feed_data
if t.skip(t.is_os('win')) then
diff --git a/test/functional/autocmd/modechanged_spec.lua b/test/functional/autocmd/modechanged_spec.lua
index f0321ff71d..61ce15d91d 100644
--- a/test/functional/autocmd/modechanged_spec.lua
+++ b/test/functional/autocmd/modechanged_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eval, eq = t.clear, t.eval, t.eq
-local feed, command = t.feed, t.command
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eval, eq = n.clear, n.eval, t.eq
+local feed, command = n.feed, n.command
+local exec_lua = n.exec_lua
describe('ModeChanged', function()
before_each(function()
diff --git a/test/functional/autocmd/recording_spec.lua b/test/functional/autocmd/recording_spec.lua
index f6ef1c56c5..6ee61c5676 100644
--- a/test/functional/autocmd/recording_spec.lua
+++ b/test/functional/autocmd/recording_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local source_vim = t.source
+local eval = n.eval
+local source_vim = n.source
describe('RecordingEnter', function()
before_each(clear)
diff --git a/test/functional/autocmd/safestate_spec.lua b/test/functional/autocmd/safestate_spec.lua
index 746a1aeb98..c45a64e373 100644
--- a/test/functional/autocmd/safestate_spec.lua
+++ b/test/functional/autocmd/safestate_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local exec = t.exec
-local feed = t.feed
-local api = t.api
+local exec = n.exec
+local feed = n.feed
+local api = n.api
before_each(clear)
diff --git a/test/functional/autocmd/searchwrapped_spec.lua b/test/functional/autocmd/searchwrapped_spec.lua
index bcb8fef046..0c0b3595ca 100644
--- a/test/functional/autocmd/searchwrapped_spec.lua
+++ b/test/functional/autocmd/searchwrapped_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
-local api = t.api
+local clear = n.clear
+local command = n.command
+local api = n.api
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
+local eval = n.eval
+local feed = n.feed
describe('autocmd SearchWrapped', function()
before_each(function()
diff --git a/test/functional/autocmd/show_spec.lua b/test/functional/autocmd/show_spec.lua
index cb3e655029..7e1818c4fd 100644
--- a/test/functional/autocmd/show_spec.lua
+++ b/test/functional/autocmd/show_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local dedent = t.dedent
local eq = t.eq
-local fn = t.fn
-local eval = t.eval
-local exec = t.exec
-local feed = t.feed
+local fn = n.fn
+local eval = n.eval
+local exec = n.exec
+local feed = n.feed
describe(':autocmd', function()
before_each(function()
diff --git a/test/functional/autocmd/signal_spec.lua b/test/functional/autocmd/signal_spec.lua
index 8ff7ee9e0f..4416afb3ba 100644
--- a/test/functional/autocmd/signal_spec.lua
+++ b/test/functional/autocmd/signal_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local fn = t.fn
-local next_msg = t.next_msg
+local fn = n.fn
+local next_msg = n.next_msg
local is_os = t.is_os
local skip = t.skip
diff --git a/test/functional/autocmd/tabclose_spec.lua b/test/functional/autocmd/tabclose_spec.lua
index c29fb08642..fde72cf4d7 100644
--- a/test/functional/autocmd/tabclose_spec.lua
+++ b/test/functional/autocmd/tabclose_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eq = t.clear, t.eq
-local api = t.api
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq = n.clear, t.eq
+local api = n.api
+local command = n.command
describe('TabClosed', function()
before_each(clear)
diff --git a/test/functional/autocmd/tabnew_spec.lua b/test/functional/autocmd/tabnew_spec.lua
index 314b27bdba..80ab5a1944 100644
--- a/test/functional/autocmd/tabnew_spec.lua
+++ b/test/functional/autocmd/tabnew_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
describe('autocmd TabNew', function()
before_each(clear)
diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua
index fa3c2cf658..fcfebd7af5 100644
--- a/test/functional/autocmd/tabnewentered_spec.lua
+++ b/test/functional/autocmd/tabnewentered_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local dedent = t.dedent
-local eval = t.eval
+local eval = n.eval
local eq = t.eq
-local feed = t.feed
-local api = t.api
-local exec_capture = t.exec_capture
+local feed = n.feed
+local api = n.api
+local exec_capture = n.exec_capture
describe('TabNewEntered', function()
describe('au TabNewEntered', function()
diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua
index 88850cea52..a63996ae36 100644
--- a/test/functional/autocmd/termxx_spec.lua
+++ b/test/functional/autocmd/termxx_spec.lua
@@ -1,15 +1,16 @@
-local uv = vim.uv
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local tt = require('test.functional.terminal.testutil')
+local uv = vim.uv
-local clear, command, testprg = t.clear, t.command, t.testprg
-local eval, eq, neq, retry = t.eval, t.eq, t.neq, t.retry
+local clear, command, testprg = n.clear, n.command, n.testprg
+local eval, eq, neq, retry = n.eval, t.eq, t.neq, t.retry
local matches = t.matches
local ok = t.ok
-local feed = t.feed
-local api = t.api
+local feed = n.feed
+local api = n.api
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local skip = t.skip
local is_os = t.is_os
diff --git a/test/functional/autocmd/textchanged_spec.lua b/test/functional/autocmd/textchanged_spec.lua
index 1991632cca..7c679cd4c0 100644
--- a/test/functional/autocmd/textchanged_spec.lua
+++ b/test/functional/autocmd/textchanged_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec = t.exec
-local command = t.command
-local feed = t.feed
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec = n.exec
+local command = n.command
+local feed = n.feed
local eq = t.eq
local neq = t.neq
-local eval = t.eval
-local poke_eventloop = t.poke_eventloop
+local eval = n.eval
+local poke_eventloop = n.poke_eventloop
local write_file = t.write_file
-- oldtest: Test_ChangedP()
diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua
index 9c77874652..cf8cbe25c1 100644
--- a/test/functional/autocmd/textyankpost_spec.lua
+++ b/test/functional/autocmd/textyankpost_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eval, eq = t.clear, t.eval, t.eq
-local feed, command, expect = t.feed, t.command, t.expect
-local api, fn, neq = t.api, t.fn, t.neq
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eval, eq = n.clear, n.eval, t.eq
+local feed, command, expect = n.feed, n.command, n.expect
+local api, fn, neq = n.api, n.fn, t.neq
describe('TextYankPost', function()
before_each(function()
diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua
index 467f80d67f..72bbc1e469 100644
--- a/test/functional/autocmd/win_scrolled_resized_spec.lua
+++ b/test/functional/autocmd/win_scrolled_resized_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local exec = t.exec
-local command = t.command
-local feed = t.feed
-local api = t.api
-local assert_alive = t.assert_alive
+local eval = n.eval
+local exec = n.exec
+local command = n.command
+local feed = n.feed
+local api = n.api
+local assert_alive = n.assert_alive
before_each(clear)
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua
index 84a7bf6ddc..a98e190a60 100644
--- a/test/functional/core/channels_spec.lua
+++ b/test/functional/core/channels_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
-local clear, eq, eval, next_msg, ok, source = t.clear, t.eq, t.eval, t.next_msg, t.ok, t.source
-local command, fn, api = t.command, t.fn, t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, eval, next_msg, ok, source = n.clear, t.eq, n.eval, n.next_msg, t.ok, n.source
+local command, fn, api = n.command, n.fn, n.api
local matches = t.matches
local sleep = vim.uv.sleep
-local spawn, nvim_argv = t.spawn, t.nvim_argv
-local get_session, set_session = t.get_session, t.set_session
-local nvim_prog = t.nvim_prog
+local spawn, nvim_argv = n.spawn, n.nvim_argv
+local get_session, set_session = n.get_session, n.set_session
+local nvim_prog = n.nvim_prog
local is_os = t.is_os
local retry = t.retry
-local expect_twostreams = t.expect_twostreams
-local assert_alive = t.assert_alive
+local expect_twostreams = n.expect_twostreams
+local assert_alive = n.assert_alive
local pcall_err = t.pcall_err
local skip = t.skip
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua
index 0e7ddf8bd1..34c3eedbd2 100644
--- a/test/functional/core/exit_spec.lua
+++ b/test/functional/core/exit_spec.lua
@@ -1,24 +1,25 @@
-local t = require('test.functional.testutil')()
-
-local assert_alive = t.assert_alive
-local command = t.command
-local feed_command = t.feed_command
-local feed = t.feed
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local command = n.command
+local feed_command = n.feed_command
+local feed = n.feed
+local eval = n.eval
local eq = t.eq
-local run = t.run
-local fn = t.fn
-local nvim_prog = t.nvim_prog
+local run = n.run
+local fn = n.fn
+local nvim_prog = n.nvim_prog
local pcall_err = t.pcall_err
-local exec_capture = t.exec_capture
-local poke_eventloop = t.poke_eventloop
+local exec_capture = n.exec_capture
+local poke_eventloop = n.poke_eventloop
describe('v:exiting', function()
local cid
before_each(function()
- t.clear()
- cid = t.api.nvim_get_chan_info(0).id
+ n.clear()
+ cid = n.api.nvim_get_chan_info(0).id
end)
it('defaults to v:null', function()
@@ -74,7 +75,7 @@ describe(':cquit', function()
end
before_each(function()
- t.clear()
+ n.clear()
end)
it('exits with non-zero after :cquit', function()
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua
index 349f79e316..5b0be1e83c 100644
--- a/test/functional/core/fileio_spec.lua
+++ b/test/functional/core/fileio_spec.lua
@@ -1,37 +1,38 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
local uv = vim.uv
-local t = require('test.functional.testutil')()
local assert_log = t.assert_log
local assert_nolog = t.assert_nolog
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
local neq = t.neq
local ok = t.ok
-local feed = t.feed
-local fn = t.fn
-local nvim_prog = t.nvim_prog
-local request = t.request
+local feed = n.feed
+local fn = n.fn
+local nvim_prog = n.nvim_prog
+local request = n.request
local retry = t.retry
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local matches = t.matches
-local api = t.api
+local api = n.api
local mkdir = t.mkdir
local sleep = vim.uv.sleep
local read_file = t.read_file
local trim = vim.trim
-local currentdir = t.fn.getcwd
-local assert_alive = t.assert_alive
-local check_close = t.check_close
-local expect_exit = t.expect_exit
+local currentdir = n.fn.getcwd
+local assert_alive = n.assert_alive
+local check_close = n.check_close
+local expect_exit = n.expect_exit
local write_file = t.write_file
-local Screen = require('test.functional.ui.screen')
-local feed_command = t.feed_command
+local feed_command = n.feed_command
local skip = t.skip
local is_os = t.is_os
local is_ci = t.is_ci
-local spawn = t.spawn
-local set_session = t.set_session
+local spawn = n.spawn
+local set_session = n.set_session
describe('fileio', function()
before_each(function() end)
@@ -228,7 +229,7 @@ describe('fileio', function()
local initial_content = 'foo'
local backup_dir = 'Xtest_backupdir'
- local sep = t.get_pathsep()
+ local sep = n.get_pathsep()
local link_file_name = 'Xtest_startup_file2'
local backup_file_name = backup_dir .. sep .. link_file_name .. '~'
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index f8144e9c05..e1efc07452 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -1,38 +1,39 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
local tt = require('test.functional.terminal.testutil')
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local exc_exec = t.exc_exec
-local feed_command = t.feed_command
-local feed = t.feed
-local insert = t.insert
+local eval = n.eval
+local exc_exec = n.exc_exec
+local feed_command = n.feed_command
+local feed = n.feed
+local insert = n.insert
local neq = t.neq
-local next_msg = t.next_msg
-local testprg = t.testprg
+local next_msg = n.next_msg
+local testprg = n.testprg
local ok = t.ok
-local source = t.source
+local source = n.source
local write_file = t.write_file
local mkdir = t.mkdir
-local rmdir = t.rmdir
-local assert_alive = t.assert_alive
-local command = t.command
-local fn = t.fn
-local os_kill = t.os_kill
+local rmdir = n.rmdir
+local assert_alive = n.assert_alive
+local command = n.command
+local fn = n.fn
+local os_kill = n.os_kill
local retry = t.retry
-local api = t.api
+local api = n.api
local NIL = vim.NIL
-local poke_eventloop = t.poke_eventloop
-local get_pathsep = t.get_pathsep
-local pathroot = t.pathroot
-local exec_lua = t.exec_lua
-local nvim_set = t.nvim_set
-local expect_twostreams = t.expect_twostreams
-local expect_msg_seq = t.expect_msg_seq
+local poke_eventloop = n.poke_eventloop
+local get_pathsep = n.get_pathsep
+local pathroot = n.pathroot
+local exec_lua = n.exec_lua
+local nvim_set = n.nvim_set
+local expect_twostreams = n.expect_twostreams
+local expect_msg_seq = n.expect_msg_seq
local pcall_err = t.pcall_err
local matches = t.matches
-local Screen = require('test.functional.ui.screen')
local skip = t.skip
local is_os = t.is_os
@@ -732,7 +733,7 @@ describe('jobs', function()
describe('jobwait()', function()
before_each(function()
if is_os('win') then
- t.set_shell_powershell()
+ n.set_shell_powershell()
end
end)
@@ -1239,7 +1240,7 @@ describe('pty process teardown', function()
skip(fn.executable('sleep') == 0, 'missing "sleep" command')
-- Use a nested nvim (in :term) to test without --headless.
fn.termopen({
- t.nvim_prog,
+ n.nvim_prog,
'-u',
'NONE',
'-i',
diff --git a/test/functional/core/log_spec.lua b/test/functional/core/log_spec.lua
index dd08d81342..cac61cda2d 100644
--- a/test/functional/core/log_spec.lua
+++ b/test/functional/core/log_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local assert_log = t.assert_log
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local exec_lua = t.exec_lua
-local expect_exit = t.expect_exit
-local request = t.request
+local exec_lua = n.exec_lua
+local expect_exit = n.expect_exit
+local request = n.request
describe('log', function()
local testlog = 'Xtest_logging'
diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua
index a318fdec3c..5e903726db 100644
--- a/test/functional/core/main_spec.lua
+++ b/test/functional/core/main_spec.lua
@@ -1,14 +1,15 @@
-local uv = vim.uv
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local uv = vim.uv
local eq = t.eq
local matches = t.matches
-local feed = t.feed
-local eval = t.eval
-local clear = t.clear
-local fn = t.fn
-local nvim_prog_abs = t.nvim_prog_abs
+local feed = n.feed
+local eval = n.eval
+local clear = n.clear
+local fn = n.fn
+local nvim_prog_abs = n.nvim_prog_abs
local write_file = t.write_file
local is_os = t.is_os
local skip = t.skip
diff --git a/test/functional/core/path_spec.lua b/test/functional/core/path_spec.lua
index 92fcde978b..d8e274019a 100644
--- a/test/functional/core/path_spec.lua
+++ b/test/functional/core/path_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local fn = t.fn
-local insert = t.insert
+local eval = n.eval
+local feed = n.feed
+local fn = n.fn
+local insert = n.insert
local is_os = t.is_os
local mkdir = t.mkdir
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local write_file = t.write_file
local function join_path(...)
diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua
index 0b110a3538..6cc28ddeef 100644
--- a/test/functional/core/remote_spec.lua
+++ b/test/functional/core/remote_spec.lua
@@ -1,18 +1,19 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local exec_capture = t.exec_capture
-local exec_lua = t.exec_lua
-local expect = t.expect
-local fn = t.fn
-local insert = t.insert
-local nvim_prog = t.nvim_prog
-local new_argv = t.new_argv
+local exec_capture = n.exec_capture
+local exec_lua = n.exec_lua
+local expect = n.expect
+local fn = n.fn
+local insert = n.insert
+local nvim_prog = n.nvim_prog
+local new_argv = n.new_argv
local neq = t.neq
-local set_session = t.set_session
-local spawn = t.spawn
+local set_session = n.set_session
+local spawn = n.spawn
local tmpname = t.tmpname
local write_file = t.write_file
diff --git a/test/functional/core/spellfile_spec.lua b/test/functional/core/spellfile_spec.lua
index 814df522cf..e2ccb038e7 100644
--- a/test/functional/core/spellfile_spec.lua
+++ b/test/functional/core/spellfile_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local api = t.api
-local exc_exec = t.exc_exec
-local fn = t.fn
-local rmdir = t.rmdir
+local clear = n.clear
+local api = n.api
+local exc_exec = n.exc_exec
+local fn = n.fn
+local rmdir = n.rmdir
local write_file = t.write_file
local mkdir = t.mkdir
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index e98b1bdd87..a53625ab1b 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -1,38 +1,39 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local assert_log = t.assert_log
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local ok = t.ok
local eq = t.eq
local matches = t.matches
-local eval = t.eval
-local exec = t.exec
-local exec_capture = t.exec_capture
-local exec_lua = t.exec_lua
-local feed = t.feed
-local fn = t.fn
+local eval = n.eval
+local exec = n.exec
+local exec_capture = n.exec_capture
+local exec_lua = n.exec_lua
+local feed = n.feed
+local fn = n.fn
local pesc = vim.pesc
local mkdir = t.mkdir
-local mkdir_p = t.mkdir_p
-local nvim_prog = t.nvim_prog
-local nvim_set = t.nvim_set
+local mkdir_p = n.mkdir_p
+local nvim_prog = n.nvim_prog
+local nvim_set = n.nvim_set
local read_file = t.read_file
local retry = t.retry
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local sleep = vim.uv.sleep
local startswith = vim.startswith
local write_file = t.write_file
-local api = t.api
-local alter_slashes = t.alter_slashes
+local api = n.api
+local alter_slashes = n.alter_slashes
local is_os = t.is_os
local dedent = t.dedent
local tbl_map = vim.tbl_map
local tbl_filter = vim.tbl_filter
local endswith = vim.endswith
-local check_close = t.check_close
+local check_close = n.check_close
local testlog = 'Xtest-startupspec-log'
@@ -994,7 +995,7 @@ describe('sysinit', function()
local xdgdir = 'Xxdg'
local vimdir = 'Xvim'
local xhome = 'Xhome'
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
before_each(function()
rmdir(xdgdir)
@@ -1055,7 +1056,7 @@ end)
describe('user config init', function()
local xhome = 'Xhome'
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = xhome .. pathsep .. 'Xconfig'
local xdata = xhome .. pathsep .. 'Xdata'
local init_lua_path = table.concat({ xconfig, 'nvim', 'init.lua' }, pathsep)
@@ -1218,7 +1219,7 @@ end)
describe('runtime:', function()
local xhome = 'Xhome'
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = xhome .. pathsep .. 'Xconfig'
local xdata = xhome .. pathsep .. 'Xdata'
local xenv = { XDG_CONFIG_HOME = xconfig, XDG_DATA_HOME = xdata }
@@ -1360,7 +1361,7 @@ end)
describe('user session', function()
local xhome = 'Xhome'
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local session_file = table.concat({ xhome, 'session.lua' }, pathsep)
before_each(function()
diff --git a/test/functional/editor/K_spec.lua b/test/functional/editor/K_spec.lua
index 91038e5f4e..3c58892731 100644
--- a/test/functional/editor/K_spec.lua
+++ b/test/functional/editor/K_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local eq, clear, eval, feed, api, retry = t.eq, t.clear, t.eval, t.feed, t.api, t.retry
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, clear, eval, feed, api, retry = t.eq, n.clear, n.eval, n.feed, n.api, t.retry
describe('K', function()
local test_file = 'K_spec_out'
@@ -12,19 +14,19 @@ describe('K', function()
end)
it("invokes colon-prefixed 'keywordprg' as Vim command", function()
- t.source([[
+ n.source([[
let @a='fnord'
set keywordprg=:put]])
-- K on the text "a" resolves to `:put a`.
feed('ia<ESC>K')
- t.expect([[
+ n.expect([[
a
fnord]])
end)
it("invokes non-prefixed 'keywordprg' as shell command", function()
- t.source([[
+ n.source([[
let @a='fnord'
set keywordprg=echo\ fnord>>]])
@@ -42,7 +44,7 @@ describe('K', function()
end)
it("<esc> kills the buffer for a running 'keywordprg' command", function()
- t.source('set keywordprg=less')
+ n.source('set keywordprg=less')
eval('writefile(["hello", "world"], "' .. test_file .. '")')
feed('i' .. test_file .. '<esc>K')
eq('t', eval('mode()'))
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index c479a9ccf1..62bb7e19f3 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local clear, feed = t.clear, t.feed
-local eval, eq, neq = t.eval, t.eq, t.neq
-local feed_command, source, expect = t.feed_command, t.source, t.expect
-local fn = t.fn
-local command = t.command
-local api = t.api
-local poke_eventloop = t.poke_eventloop
+
+local assert_alive = n.assert_alive
+local clear, feed = n.clear, n.feed
+local eval, eq, neq = n.eval, t.eq, t.neq
+local feed_command, source, expect = n.feed_command, n.source, n.expect
+local fn = n.fn
+local command = n.command
+local api = n.api
+local poke_eventloop = n.poke_eventloop
describe('completion', function()
local screen
diff --git a/test/functional/editor/count_spec.lua b/test/functional/editor/count_spec.lua
index 6a3efcf515..d158497cb8 100644
--- a/test/functional/editor/count_spec.lua
+++ b/test/functional/editor/count_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
-local command = t.command
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
+local command = n.command
describe('v:count/v:count1', function()
before_each(function()
diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua
index b0160630d9..e1258c7df8 100644
--- a/test/functional/editor/ctrl_c_spec.lua
+++ b/test/functional/editor/ctrl_c_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, source = t.clear, t.feed, t.source
-local command = t.command
-local poke_eventloop = t.poke_eventloop
+
+local clear, feed, source = n.clear, n.feed, n.source
+local command = n.command
+local poke_eventloop = n.poke_eventloop
local sleep = vim.uv.sleep
describe('CTRL-C (mapped)', function()
diff --git a/test/functional/editor/fold_spec.lua b/test/functional/editor/fold_spec.lua
index 336b97b15e..ee3f268a2a 100644
--- a/test/functional/editor/fold_spec.lua
+++ b/test/functional/editor/fold_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
-
-local clear = t.clear
-local insert = t.insert
-local exec = t.exec
-local feed = t.feed
-local expect = t.expect
-local command = t.command
-local fn = t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local insert = n.insert
+local exec = n.exec
+local feed = n.feed
+local expect = n.expect
+local command = n.command
+local fn = n.fn
local eq = t.eq
local neq = t.neq
@@ -376,7 +377,7 @@ a]],
end)
it('splits folds according to >N and <N with foldexpr', function()
- t.source([[
+ n.source([[
function TestFoldExpr(lnum)
let thisline = getline(a:lnum)
if thisline == 'a'
diff --git a/test/functional/editor/jump_spec.lua b/test/functional/editor/jump_spec.lua
index 5911fcdbfb..880831d9f8 100644
--- a/test/functional/editor/jump_spec.lua
+++ b/test/functional/editor/jump_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local dedent = t.dedent
local eq = t.eq
-local fn = t.fn
-local feed = t.feed
-local exec_capture = t.exec_capture
+local fn = n.fn
+local feed = n.feed
+local exec_capture = n.exec_capture
local write_file = t.write_file
-local api = t.api
+local api = n.api
describe('jumplist', function()
local fname1 = 'Xtest-functional-normal-jump'
diff --git a/test/functional/editor/lang_spec.lua b/test/functional/editor/lang_spec.lua
index 0e11a53999..74d83bcfa8 100644
--- a/test/functional/editor/lang_spec.lua
+++ b/test/functional/editor/lang_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear, insert, eq = t.clear, t.insert, t.eq
-local command, expect = t.command, t.expect
-local feed, eval = t.feed, t.eval
-local exc_exec = t.exc_exec
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, insert, eq = n.clear, n.insert, t.eq
+local command, expect = n.command, n.expect
+local feed, eval = n.feed, n.eval
+local exc_exec = n.exc_exec
describe('gu and gU', function()
before_each(clear)
diff --git a/test/functional/editor/langmap_spec.lua b/test/functional/editor/langmap_spec.lua
index a17bbc4f16..e50e19a468 100644
--- a/test/functional/editor/langmap_spec.lua
+++ b/test/functional/editor/langmap_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local eq, neq, call = t.eq, t.neq, t.call
-local eval, feed, clear = t.eval, t.feed, t.clear
-local command, insert, expect = t.command, t.insert, t.expect
-local feed_command = t.feed_command
-local curwin = t.api.nvim_get_current_win
+local eq, neq, call = t.eq, t.neq, n.call
+local eval, feed, clear = n.eval, n.feed, n.clear
+local command, insert, expect = n.command, n.insert, n.expect
+local feed_command = n.feed_command
+local curwin = n.api.nvim_get_current_win
describe("'langmap'", function()
before_each(function()
@@ -133,7 +134,7 @@ describe("'langmap'", function()
hello]])
end)
it('command-line CTRL-R', function()
- t.source([[
+ n.source([[
let i_value = 0
let j_value = 0
call setreg('i', 'i_value')
@@ -171,7 +172,7 @@ describe("'langmap'", function()
end)
it('prompt for number', function()
command('set langmap=12,21')
- t.source([[
+ n.source([[
let gotten_one = 0
function Map()
let answer = inputlist(['a', '1.', '2.', '3.'])
@@ -214,7 +215,7 @@ describe("'langmap'", function()
end
feed('qa' .. command_string .. 'q')
expect(expect_string)
- eq(expect_macro or t.fn.nvim_replace_termcodes(command_string, true, true, true), eval('@a'))
+ eq(expect_macro or n.fn.nvim_replace_termcodes(command_string, true, true, true), eval('@a'))
if setup_function then
setup_function()
end
diff --git a/test/functional/editor/macro_spec.lua b/test/functional/editor/macro_spec.lua
index 4e32e5b3af..27c5eddac8 100644
--- a/test/functional/editor/macro_spec.lua
+++ b/test/functional/editor/macro_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
-local expect = t.expect
-local command = t.command
-local fn = t.fn
-local api = t.api
-local insert = t.insert
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
+local expect = n.expect
+local command = n.command
+local fn = n.fn
+local api = n.api
+local insert = n.insert
describe('macros with default mappings', function()
before_each(function()
diff --git a/test/functional/editor/mark_spec.lua b/test/functional/editor/mark_spec.lua
index dfbf1e3e58..69cb95e1c3 100644
--- a/test/functional/editor/mark_spec.lua
+++ b/test/functional/editor/mark_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local api = t.api
-local clear = t.clear
-local command = t.command
-local fn = t.fn
+
+local api = n.api
+local clear = n.clear
+local command = n.command
+local fn = n.fn
local eq = t.eq
-local feed = t.feed
+local feed = n.feed
local write_file = t.write_file
local pcall_err = t.pcall_err
local cursor = function()
- return t.api.nvim_win_get_cursor(0)
+ return n.api.nvim_win_get_cursor(0)
end
describe('named marks', function()
@@ -39,59 +41,59 @@ describe('named marks', function()
it('errors when set out of range with :mark', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, '1000mark x')
+ local err = pcall_err(n.exec_capture, '1000mark x')
eq('nvim_exec2(): Vim(mark):E16: Invalid range: 1000mark x', err)
end)
it('errors when set out of range with :k', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, '1000kx')
+ local err = pcall_err(n.exec_capture, '1000kx')
eq('nvim_exec2(): Vim(k):E16: Invalid range: 1000kx', err)
end)
it('errors on unknown mark name with :mark', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, 'mark #')
+ local err = pcall_err(n.exec_capture, 'mark #')
eq('nvim_exec2(): Vim(mark):E191: Argument must be a letter or forward/backward quote', err)
end)
it("errors on unknown mark name with '", function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, "normal! '#")
+ local err = pcall_err(n.exec_capture, "normal! '#")
eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err)
end)
it('errors on unknown mark name with `', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, 'normal! `#')
+ local err = pcall_err(n.exec_capture, 'normal! `#')
eq('nvim_exec2(): Vim(normal):E78: Unknown mark', err)
end)
it("errors when moving to a mark that is not set with '", function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, "normal! 'z")
+ local err = pcall_err(n.exec_capture, "normal! 'z")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
- err = pcall_err(t.exec_capture, "normal! '.")
+ err = pcall_err(n.exec_capture, "normal! '.")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
end)
it('errors when moving to a mark that is not set with `', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, 'normal! `z')
+ local err = pcall_err(n.exec_capture, 'normal! `z')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
- err = pcall_err(t.exec_capture, 'normal! `>')
+ err = pcall_err(n.exec_capture, 'normal! `>')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
end)
it("errors when moving to a global mark that is not set with '", function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, "normal! 'Z")
+ local err = pcall_err(n.exec_capture, "normal! 'Z")
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
end)
it('errors when moving to a global mark that is not set with `', function()
command('edit ' .. file1)
- local err = pcall_err(t.exec_capture, 'normal! `Z')
+ local err = pcall_err(n.exec_capture, 'normal! `Z')
eq('nvim_exec2(): Vim(normal):E20: Mark not set', err)
end)
@@ -166,7 +168,7 @@ describe('named marks', function()
feed('mA')
command('next')
command('bw! ' .. file1)
- local err = pcall_err(t.exec_capture, "normal! 'A")
+ local err = pcall_err(n.exec_capture, "normal! 'A")
eq('nvim_exec2(): Vim(normal):E92: Buffer 1 not found', err)
os.remove(file1)
end)
diff --git a/test/functional/editor/meta_key_spec.lua b/test/functional/editor/meta_key_spec.lua
index 0dc6884fac..87fe395608 100644
--- a/test/functional/editor/meta_key_spec.lua
+++ b/test/functional/editor/meta_key_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command = t.command
-local exec_lua = t.exec_lua
-local eval = t.eval
-local expect = t.expect
-local fn = t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command = n.command
+local exec_lua = n.exec_lua
+local eval = n.eval
+local expect = n.expect
+local fn = n.fn
local eq = t.eq
describe('meta-keys #8226 #13042', function()
diff --git a/test/functional/editor/mode_cmdline_spec.lua b/test/functional/editor/mode_cmdline_spec.lua
index e52eb7aaba..70bdc5d4c2 100644
--- a/test/functional/editor/mode_cmdline_spec.lua
+++ b/test/functional/editor/mode_cmdline_spec.lua
@@ -1,11 +1,13 @@
-- Cmdline-mode tests.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, insert, fn, eq, feed = t.clear, t.insert, t.fn, t.eq, t.feed
-local eval = t.eval
-local command = t.command
-local api = t.api
+
+local clear, insert, fn, eq, feed = n.clear, n.insert, n.fn, t.eq, n.feed
+local eval = n.eval
+local command = n.command
+local api = n.api
describe('cmdline', function()
before_each(clear)
diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua
index 6d075cdf36..fb3dda4bf4 100644
--- a/test/functional/editor/mode_insert_spec.lua
+++ b/test/functional/editor/mode_insert_spec.lua
@@ -1,14 +1,16 @@
-- Insert-mode tests.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local expect = t.expect
-local command = t.command
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local expect = n.expect
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local curbuf_contents = t.curbuf_contents
-local api = t.api
+local eval = n.eval
+local curbuf_contents = n.curbuf_contents
+local api = n.api
describe('insert-mode', function()
before_each(function()
@@ -223,10 +225,10 @@ describe('insert-mode', function()
end
local function test_cols(expected_cols)
- local cols = { { t.fn.col('.'), t.fn.virtcol('.') } }
+ local cols = { { n.fn.col('.'), n.fn.virtcol('.') } }
for _ = 2, #expected_cols do
feed('<BS>')
- table.insert(cols, { t.fn.col('.'), t.fn.virtcol('.') })
+ table.insert(cols, { n.fn.col('.'), n.fn.virtcol('.') })
end
eq(expected_cols, cols)
end
diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua
index b80723a5b9..b3ef4866dc 100644
--- a/test/functional/editor/mode_normal_spec.lua
+++ b/test/functional/editor/mode_normal_spec.lua
@@ -1,11 +1,13 @@
-- Normal mode tests.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
-local fn = t.fn
-local command = t.command
+
+local clear = n.clear
+local feed = n.feed
+local fn = n.fn
+local command = n.command
local eq = t.eq
describe('Normal mode', function()
@@ -25,7 +27,7 @@ describe('Normal mode', function()
local screen = Screen.new(60, 17)
screen:attach()
fn.termopen(
- { t.nvim_prog, '--clean', '--cmd', 'startinsert' },
+ { n.nvim_prog, '--clean', '--cmd', 'startinsert' },
{ env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } }
)
screen:expect({
diff --git a/test/functional/editor/put_spec.lua b/test/functional/editor/put_spec.lua
index 85580498b7..0f6936cd31 100644
--- a/test/functional/editor/put_spec.lua
+++ b/test/functional/editor/put_spec.lua
@@ -1,17 +1,18 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local insert = t.insert
-local feed = t.feed
-local expect = t.expect
+local clear = n.clear
+local insert = n.insert
+local feed = n.feed
+local expect = n.expect
local eq = t.eq
local map = vim.tbl_map
local filter = vim.tbl_filter
-local feed_command = t.feed_command
-local command = t.command
-local curbuf_contents = t.curbuf_contents
-local fn = t.fn
+local feed_command = n.feed_command
+local command = n.command
+local curbuf_contents = n.curbuf_contents
+local fn = n.fn
local dedent = t.dedent
local function reset()
diff --git a/test/functional/editor/search_spec.lua b/test/functional/editor/search_spec.lua
index c8c7c688f6..770a4f387d 100644
--- a/test/functional/editor/search_spec.lua
+++ b/test/functional/editor/search_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/editor/tabpage_spec.lua b/test/functional/editor/tabpage_spec.lua
index 4b880e21bf..0b26494436 100644
--- a/test/functional/editor/tabpage_spec.lua
+++ b/test/functional/editor/tabpage_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
local neq = t.neq
-local feed = t.feed
-local eval = t.eval
-local exec = t.exec
-local fn = t.fn
-local api = t.api
-local curwin = t.api.nvim_get_current_win
-local assert_alive = t.assert_alive
+local feed = n.feed
+local eval = n.eval
+local exec = n.exec
+local fn = n.fn
+local api = n.api
+local curwin = n.api.nvim_get_current_win
+local assert_alive = n.assert_alive
describe('tabpage', function()
before_each(clear)
diff --git a/test/functional/editor/undo_spec.lua b/test/functional/editor/undo_spec.lua
index 70ed5b6756..12056394d2 100644
--- a/test/functional/editor/undo_spec.lua
+++ b/test/functional/editor/undo_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
-local eval = t.eval
-local expect = t.expect
+local clear = n.clear
+local command = n.command
+local eval = n.eval
+local expect = n.expect
local eq = t.eq
-local feed = t.feed
-local feed_command = t.feed_command
-local insert = t.insert
-local fn = t.fn
-local exec = t.exec
-local exec_lua = t.exec_lua
+local feed = n.feed
+local feed_command = n.feed_command
+local insert = n.insert
+local fn = n.fn
+local exec = n.exec
+local exec_lua = n.exec_lua
local function lastmessage()
local messages = fn.split(fn.execute('messages'), '\n')
@@ -44,7 +45,7 @@ describe('u CTRL-R g- g+', function()
local function undo_and_redo(hist_pos, undo, redo, expect_str)
command('enew!')
create_history(hist_pos)
- local cur_contents = t.curbuf_contents()
+ local cur_contents = n.curbuf_contents()
feed(undo)
expect(expect_str)
feed(redo)
diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua
index 4d50bfb5a1..80fdcb3134 100644
--- a/test/functional/ex_cmds/append_spec.lua
+++ b/test/functional/ex_cmds/append_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
local eq = t.eq
local dedent = t.dedent
-local exec = t.exec
-local feed = t.feed
-local clear = t.clear
-local fn = t.fn
-local command = t.command
-local api = t.api
-local Screen = require('test.functional.ui.screen')
+local exec = n.exec
+local feed = n.feed
+local clear = n.clear
+local fn = n.fn
+local command = n.command
+local api = n.api
local cmdtest = function(cmd, prep, ret1)
describe(':' .. cmd, function()
diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua
index 71a2f4ed77..9b89823dcc 100644
--- a/test/functional/ex_cmds/arg_spec.lua
+++ b/test/functional/ex_cmds/arg_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local eq, command, fn = t.eq, t.command, t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, command, fn = t.eq, n.command, n.fn
local ok = t.ok
local matches = t.matches
-local clear = t.clear
+local clear = n.clear
describe(':argument', function()
before_each(function()
@@ -11,19 +13,19 @@ describe(':argument', function()
it('does not restart :terminal buffer', function()
command('terminal')
- t.feed([[<C-\><C-N>]])
+ n.feed([[<C-\><C-N>]])
command('argadd')
- t.feed([[<C-\><C-N>]])
+ n.feed([[<C-\><C-N>]])
local bufname_before = fn.bufname('%')
local bufnr_before = fn.bufnr('%')
matches('^term://', bufname_before) -- sanity
command('argument 1')
- t.feed([[<C-\><C-N>]])
+ n.feed([[<C-\><C-N>]])
local bufname_after = fn.bufname('%')
local bufnr_after = fn.bufnr('%')
- eq('[' .. bufname_before .. ']', t.eval('trim(execute("args"))'))
+ eq('[' .. bufname_before .. ']', n.eval('trim(execute("args"))'))
ok(fn.line('$') > 1)
eq(bufname_before, bufname_after)
eq(bufnr_before, bufnr_after)
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 7568d6c935..0f95f2aca4 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -1,13 +1,14 @@
-- Specs for :cd, :tcd, :lcd and getcwd()
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local call = t.call
-local clear = t.clear
-local command = t.command
-local exc_exec = t.exc_exec
-local pathsep = t.get_pathsep()
+local call = n.call
+local clear = n.clear
+local command = n.command
+local exc_exec = n.exc_exec
+local pathsep = n.get_pathsep()
local skip = t.skip
local is_os = t.is_os
local mkdir = t.mkdir
@@ -289,14 +290,14 @@ describe('getcwd()', function()
end)
after_each(function()
- t.rmdir(directories.global)
+ n.rmdir(directories.global)
end)
it('returns empty string if working directory does not exist', function()
skip(is_os('win'))
command('cd ' .. directories.global)
command("call delete('../" .. directories.global .. "', 'd')")
- eq('', t.eval('getcwd()'))
+ eq('', n.eval('getcwd()'))
end)
it("works with 'autochdir' after local directory was set (#9892)", function()
diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua
index e77d213ea3..6c1ac8eae5 100644
--- a/test/functional/ex_cmds/cmd_map_spec.lua
+++ b/test/functional/ex_cmds/cmd_map_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local feed = t.feed
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
+
+local clear = n.clear
+local feed = n.feed
local eq = t.eq
-local expect = t.expect
-local eval = t.eval
-local fn = t.fn
-local insert = t.insert
+local expect = n.expect
+local eval = n.eval
+local fn = n.fn
+local insert = n.insert
local write_file = t.write_file
-local exc_exec = t.exc_exec
-local command = t.command
-local Screen = require('test.functional.ui.screen')
+local exc_exec = n.exc_exec
+local command = n.command
describe('mappings with <Cmd>', function()
local screen
diff --git a/test/functional/ex_cmds/debug_spec.lua b/test/functional/ex_cmds/debug_spec.lua
index b0da98a87d..ebb3cdd38a 100644
--- a/test/functional/ex_cmds/debug_spec.lua
+++ b/test/functional/ex_cmds/debug_spec.lua
@@ -1,7 +1,8 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
-local clear = t.clear
+
+local feed = n.feed
+local clear = n.clear
describe(':debug', function()
local screen
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua
index 23aeb4ee9d..b6068a86db 100644
--- a/test/functional/ex_cmds/dict_notifications_spec.lua
+++ b/test/functional/ex_cmds/dict_notifications_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
-local assert_alive = t.assert_alive
-local clear, source = t.clear, t.source
-local api = t.api
-local insert = t.insert
-local eq, next_msg = t.eq, t.next_msg
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local command = t.command
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local clear, source = n.clear, n.source
+local api = n.api
+local insert = n.insert
+local eq, next_msg = t.eq, n.next_msg
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local command = n.command
+local eval = n.eval
describe('Vimscript dictionary notifications', function()
local channel
diff --git a/test/functional/ex_cmds/digraphs_spec.lua b/test/functional/ex_cmds/digraphs_spec.lua
index ec83db9a84..fde25c028f 100644
--- a/test/functional/ex_cmds/digraphs_spec.lua
+++ b/test/functional/ex_cmds/digraphs_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local clear = n.clear
+local command = n.command
+local feed = n.feed
+
describe(':digraphs', function()
local screen
before_each(function()
diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua
index 6b875270c8..54ddd79a35 100644
--- a/test/functional/ex_cmds/drop_spec.lua
+++ b/test/functional/ex_cmds/drop_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
-local command = t.command
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, feed_command = t.clear, t.feed, t.feed_command
-local exec = t.exec
+
+local command = n.command
+local clear, feed, feed_command = n.clear, n.feed, n.feed_command
+local exec = n.exec
describe(':drop', function()
local screen
diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua
index 3b523d2c98..2f0bcb4d9d 100644
--- a/test/functional/ex_cmds/echo_spec.lua
+++ b/test/functional/ex_cmds/echo_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
local NIL = vim.NIL
-local eval = t.eval
-local clear = t.clear
-local api = t.api
-local fn = t.fn
-local source = t.source
+local eval = n.eval
+local clear = n.clear
+local api = n.api
+local fn = n.fn
+local source = n.source
local dedent = t.dedent
-local command = t.command
-local exc_exec = t.exc_exec
-local exec_capture = t.exec_capture
+local command = n.command
+local exc_exec = n.exc_exec
+local exec_capture = n.exec_capture
local matches = t.matches
describe(':echo :echon :echomsg :echoerr', function()
@@ -349,8 +350,8 @@ describe(':echo :echon :echomsg :echoerr', function()
end)
describe('used to represent special values', function()
- local function chr(n)
- return ('%c'):format(n)
+ local function chr(_n)
+ return ('%c'):format(_n)
end
local function ctrl(c)
return ('%c'):format(c:upper():byte() - 0x40)
diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua
index c51b860aeb..39849a202f 100644
--- a/test/functional/ex_cmds/edit_spec.lua
+++ b/test/functional/ex_cmds/edit_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local eq, command, fn = t.eq, t.command, t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, command, fn = t.eq, n.command, n.fn
local ok = t.ok
local matches = t.matches
-local clear = t.clear
-local feed = t.feed
+local clear = n.clear
+local feed = n.feed
describe(':edit', function()
before_each(function()
diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua
index 520ed6fff6..6b882253b9 100644
--- a/test/functional/ex_cmds/encoding_spec.lua
+++ b/test/functional/ex_cmds/encoding_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, feed_command, feed = t.clear, t.feed_command, t.feed
-local eq, neq, eval = t.eq, t.neq, t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed_command, feed = n.clear, n.feed_command, n.feed
+local eq, neq, eval = t.eq, t.neq, n.eval
describe('&encoding', function()
before_each(function()
diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua
index cb277263c7..20ebb2dedb 100644
--- a/test/functional/ex_cmds/excmd_spec.lua
+++ b/test/functional/ex_cmds/excmd_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local command = n.command
local eq = t.eq
-local clear = t.clear
-local fn = t.fn
+local clear = n.clear
+local fn = n.fn
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('Ex cmds', function()
before_each(function()
diff --git a/test/functional/ex_cmds/file_spec.lua b/test/functional/ex_cmds/file_spec.lua
index 654d96cb77..0c51f1c17b 100644
--- a/test/functional/ex_cmds/file_spec.lua
+++ b/test/functional/ex_cmds/file_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local fn = t.fn
-local rmdir = t.rmdir
+local fn = n.fn
+local rmdir = n.rmdir
local mkdir = t.mkdir
describe(':file', function()
diff --git a/test/functional/ex_cmds/grep_spec.lua b/test/functional/ex_cmds/grep_spec.lua
index 328064ed3c..f7d0f43c62 100644
--- a/test/functional/ex_cmds/grep_spec.lua
+++ b/test/functional/ex_cmds/grep_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local clear, feed_command, feed, ok, eval = t.clear, t.feed_command, t.feed, t.ok, t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed_command, feed, ok, eval = n.clear, n.feed_command, n.feed, t.ok, n.eval
describe(':grep', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/help_spec.lua b/test/functional/ex_cmds/help_spec.lua
index 9a86b2b345..f0a7bea7e4 100644
--- a/test/functional/ex_cmds/help_spec.lua
+++ b/test/functional/ex_cmds/help_spec.lua
@@ -1,19 +1,20 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local fn = t.fn
-local api = t.api
+local fn = n.fn
+local api = n.api
local mkdir = t.mkdir
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local write_file = t.write_file
describe(':help', function()
before_each(clear)
it('window closed makes cursor return to a valid win/buf #9773', function()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
command('help help')
eq(1001, fn.win_getid())
command('quit')
diff --git a/test/functional/ex_cmds/highlight_spec.lua b/test/functional/ex_cmds/highlight_spec.lua
index a34e9c1659..3cb6cc2579 100644
--- a/test/functional/ex_cmds/highlight_spec.lua
+++ b/test/functional/ex_cmds/highlight_spec.lua
@@ -1,11 +1,13 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local eq, command = t.eq, t.command
-local clear = t.clear
-local eval, exc_exec = t.eval, t.exc_exec
-local exec = t.exec
-local fn = t.fn
-local api = t.api
+
+local eq, command = t.eq, n.command
+local clear = n.clear
+local eval, exc_exec = n.eval, n.exc_exec
+local exec = n.exec
+local fn = n.fn
+local api = n.api
describe(':highlight', function()
local screen
diff --git a/test/functional/ex_cmds/ls_spec.lua b/test/functional/ex_cmds/ls_spec.lua
index e8c61a0c59..aab53f0634 100644
--- a/test/functional/ex_cmds/ls_spec.lua
+++ b/test/functional/ex_cmds/ls_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local api = t.api
-local testprg = t.testprg
+local eval = n.eval
+local feed = n.feed
+local api = n.api
+local testprg = n.testprg
local retry = t.retry
describe(':ls', function()
diff --git a/test/functional/ex_cmds/make_spec.lua b/test/functional/ex_cmds/make_spec.lua
index dc991dfc09..d6164cec29 100644
--- a/test/functional/ex_cmds/make_spec.lua
+++ b/test/functional/ex_cmds/make_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local eval = t.eval
-local has_powershell = t.has_powershell
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local eval = n.eval
+local has_powershell = n.has_powershell
local matches = t.matches
-local api = t.api
-local testprg = t.testprg
+local api = n.api
+local testprg = n.testprg
describe(':make', function()
clear()
@@ -18,7 +20,7 @@ describe(':make', function()
return
end
before_each(function()
- t.set_shell_powershell()
+ n.set_shell_powershell()
end)
it('captures stderr & non zero exit code #14349', function()
diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua
index 4a20ff939c..9ef0a8ec2e 100644
--- a/test/functional/ex_cmds/map_spec.lua
+++ b/test/functional/ex_cmds/map_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
-local exec = t.exec
-local exec_capture = t.exec_capture
-local feed = t.feed
-local api = t.api
-local clear = t.clear
-local command = t.command
-local expect = t.expect
-local insert = t.insert
-local eval = t.eval
+local exec = n.exec
+local exec_capture = n.exec_capture
+local feed = n.feed
+local api = n.api
+local clear = n.clear
+local command = n.command
+local expect = n.expect
+local insert = n.insert
+local eval = n.eval
describe(':*map', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua
index 2834338a1a..e73f705a29 100644
--- a/test/functional/ex_cmds/menu_spec.lua
+++ b/test/functional/ex_cmds/menu_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear, command = t.clear, t.command
-local expect, feed = t.expect, t.feed
-local eq, eval = t.eq, t.eval
-local fn = t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, command = n.clear, n.command
+local expect, feed = n.expect, n.feed
+local eq, eval = t.eq, n.eval
+local fn = n.fn
describe(':emenu', function()
before_each(function()
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua
index aeb0e5b3b0..9b24854362 100644
--- a/test/functional/ex_cmds/mksession_spec.lua
+++ b/test/functional/ex_cmds/mksession_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local get_pathsep = t.get_pathsep
+local clear = n.clear
+local command = n.command
+local get_pathsep = n.get_pathsep
local eq = t.eq
local neq = t.neq
-local fn = t.fn
+local fn = n.fn
local matches = t.matches
local pesc = vim.pesc
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local sleep = vim.uv.sleep
-local api = t.api
+local api = n.api
local skip = t.skip
local is_os = t.is_os
local mkdir = t.mkdir
diff --git a/test/functional/ex_cmds/mkview_spec.lua b/test/functional/ex_cmds/mkview_spec.lua
index 5dcf866490..7cc0b1da83 100644
--- a/test/functional/ex_cmds/mkview_spec.lua
+++ b/test/functional/ex_cmds/mkview_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
-local get_pathsep = t.get_pathsep
+local clear = n.clear
+local command = n.command
+local get_pathsep = n.get_pathsep
local eq = t.eq
-local fn = t.fn
-local rmdir = t.rmdir
+local fn = n.fn
+local rmdir = n.rmdir
local mkdir = t.mkdir
local file_prefix = 'Xtest-functional-ex_cmds-mkview_spec'
diff --git a/test/functional/ex_cmds/normal_spec.lua b/test/functional/ex_cmds/normal_spec.lua
index 0fb7635b9c..ccc649120f 100644
--- a/test/functional/ex_cmds/normal_spec.lua
+++ b/test/functional/ex_cmds/normal_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
-local fn = t.fn
-local feed = t.feed
-local expect = t.expect
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
+local fn = n.fn
+local feed = n.feed
+local expect = n.expect
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
before_each(clear)
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index f0e6a5f53a..927d780181 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -1,13 +1,14 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
-local expect_exit = t.expect_exit
-local api, eq, feed_command = t.api, t.eq, t.feed_command
-local feed, poke_eventloop = t.feed, t.poke_eventloop
+local clear = n.clear
+local command = n.command
+local expect_exit = n.expect_exit
+local api, eq, feed_command = n.api, t.eq, n.feed_command
+local feed, poke_eventloop = n.feed, n.poke_eventloop
local ok = t.ok
-local eval = t.eval
+local eval = n.eval
local shada_file = 'Xtest.shada'
@@ -109,7 +110,7 @@ describe(':browse oldfiles', function()
-- Ensure v:oldfiles isn't busted. Since things happen so fast,
-- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood).
-- Let's verify the contents and the length of v:oldfiles before moving on.
- oldfiles = t.api.nvim_get_vvar('oldfiles')
+ oldfiles = n.api.nvim_get_vvar('oldfiles')
eq(2, #oldfiles)
ok(filename == oldfiles[1] or filename == oldfiles[2])
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
diff --git a/test/functional/ex_cmds/print_commands_spec.lua b/test/functional/ex_cmds/print_commands_spec.lua
index cb94bf73de..8c164fd41b 100644
--- a/test/functional/ex_cmds/print_commands_spec.lua
+++ b/test/functional/ex_cmds/print_commands_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local clear, eq, command, fn = t.clear, t.eq, t.command, t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, command, fn = n.clear, t.eq, n.command, n.fn
describe(':z^', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/profile_spec.lua b/test/functional/ex_cmds/profile_spec.lua
index 9dc95dbb91..57e5c6b2dc 100644
--- a/test/functional/ex_cmds/profile_spec.lua
+++ b/test/functional/ex_cmds/profile_spec.lua
@@ -1,12 +1,13 @@
-require('os')
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local uv = vim.uv
+require('os')
-local t = require('test.functional.testutil')()
-local eval = t.eval
-local command = t.command
+local eval = n.eval
+local command = n.command
local eq, neq = t.eq, t.neq
local tempfile = t.tmpname()
-local source = t.source
+local source = n.source
local matches = t.matches
local read_file = t.read_file
@@ -25,10 +26,10 @@ local function assert_file_exists_not(filepath)
end
describe(':profile', function()
- before_each(t.clear)
+ before_each(n.clear)
after_each(function()
- t.expect_exit(command, 'qall!')
+ n.expect_exit(command, 'qall!')
if uv.fs_stat(tempfile).uid ~= nil then
os.remove(tempfile)
end
diff --git a/test/functional/ex_cmds/quickfix_commands_spec.lua b/test/functional/ex_cmds/quickfix_commands_spec.lua
index 072d378875..3df41b015e 100644
--- a/test/functional/ex_cmds/quickfix_commands_spec.lua
+++ b/test/functional/ex_cmds/quickfix_commands_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
+local feed = n.feed
local eq = t.eq
-local clear = t.clear
-local fn = t.fn
-local command = t.command
-local exc_exec = t.exc_exec
+local clear = n.clear
+local fn = n.fn
+local command = n.command
+local exc_exec = n.exc_exec
local write_file = t.write_file
-local api = t.api
-local source = t.source
+local api = n.api
+local source = n.source
local file_base = 'Xtest-functional-ex_cmds-quickfix_commands'
diff --git a/test/functional/ex_cmds/quit_spec.lua b/test/functional/ex_cmds/quit_spec.lua
index 14efc9ef72..83b1c5a540 100644
--- a/test/functional/ex_cmds/quit_spec.lua
+++ b/test/functional/ex_cmds/quit_spec.lua
@@ -1,5 +1,6 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
describe(':qa', function()
before_each(function()
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index 2b9f3bd353..d69fae11ce 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
local neq = t.neq
-local command = t.command
-local exec_capture = t.exec_capture
+local command = n.command
+local exec_capture = n.exec_capture
local write_file = t.write_file
-local api = t.api
-local clear = t.clear
+local api = n.api
+local clear = n.clear
local dedent = t.dedent
-local exc_exec = t.exc_exec
-local missing_provider = t.missing_provider
+local exc_exec = n.exc_exec
+local missing_provider = n.missing_provider
local tmpfile = 'X_ex_cmds_script'
diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua
index a96873a0b0..1d1708a41c 100644
--- a/test/functional/ex_cmds/sign_spec.lua
+++ b/test/functional/ex_cmds/sign_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eq, assert_alive = t.clear, t.eq, t.assert_alive
-local command = t.command
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, assert_alive = n.clear, t.eq, n.assert_alive
+local command = n.command
+local api = n.api
describe('sign', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index 99fb66cbfb..0a6f44fab4 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -1,22 +1,24 @@
-local t = require('test.functional.testutil')()
-local command = t.command
-local insert = t.insert
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local command = n.command
+local insert = n.insert
local eq = t.eq
-local clear = t.clear
-local api = t.api
-local feed = t.feed
-local feed_command = t.feed_command
+local clear = n.clear
+local api = n.api
+local feed = n.feed
+local feed_command = n.feed_command
local write_file = t.write_file
local tmpname = t.tmpname
-local exec = t.exec
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local eval = t.eval
-local exec_capture = t.exec_capture
+local exec = n.exec
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local eval = n.eval
+local exec_capture = n.exec_capture
local neq = t.neq
local matches = t.matches
local mkdir = t.mkdir
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local is_os = t.is_os
describe(':source', function()
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
index 2986b8c62f..5bb2a0181e 100644
--- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
+++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
@@ -1,27 +1,29 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
+
local uv = vim.uv
-local eq, eval, expect, exec = t.eq, t.eval, t.expect, t.exec
-local assert_alive = t.assert_alive
-local clear = t.clear
-local command = t.command
-local feed = t.feed
-local fn = t.fn
-local nvim_prog = t.nvim_prog
+local eq, eval, expect, exec = t.eq, n.eval, n.expect, n.exec
+local assert_alive = n.assert_alive
+local clear = n.clear
+local command = n.command
+local feed = n.feed
+local fn = n.fn
+local nvim_prog = n.nvim_prog
local ok = t.ok
-local rmdir = t.rmdir
-local new_argv = t.new_argv
-local new_pipename = t.new_pipename
+local rmdir = n.rmdir
+local new_argv = n.new_argv
+local new_pipename = n.new_pipename
local pesc = vim.pesc
-local os_kill = t.os_kill
-local set_session = t.set_session
-local spawn = t.spawn
-local async_meths = t.async_meths
-local expect_msg_seq = t.expect_msg_seq
+local os_kill = n.os_kill
+local set_session = n.set_session
+local spawn = n.spawn
+local async_meths = n.async_meths
+local expect_msg_seq = n.expect_msg_seq
local pcall_err = t.pcall_err
local mkdir = t.mkdir
-local poke_eventloop = t.poke_eventloop
-local api = t.api
+local poke_eventloop = n.poke_eventloop
+local api = n.api
local retry = t.retry
local write_file = t.write_file
@@ -118,7 +120,7 @@ describe("preserve and (R)ecover with custom 'directory'", function()
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
screen0:expect({ any = pesc('[No Name]') }) -- Wait for the child process to start.
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
set_session(child_session)
local swappath1 = setup_swapname()
set_session(nvim0)
diff --git a/test/functional/ex_cmds/syntax_spec.lua b/test/functional/ex_cmds/syntax_spec.lua
index 879983dc53..35b45fe800 100644
--- a/test/functional/ex_cmds/syntax_spec.lua
+++ b/test/functional/ex_cmds/syntax_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local exc_exec = t.exc_exec
+local clear = n.clear
+local exc_exec = n.exc_exec
describe(':syntax', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/trust_spec.lua b/test/functional/ex_cmds/trust_spec.lua
index 6b3ab9ff25..76248cf530 100644
--- a/test/functional/ex_cmds/trust_spec.lua
+++ b/test/functional/ex_cmds/trust_spec.lua
@@ -1,23 +1,24 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local command = t.command
-local exec_capture = t.exec_capture
+local clear = n.clear
+local command = n.command
+local exec_capture = n.exec_capture
local matches = t.matches
-local pathsep = t.get_pathsep()
+local pathsep = n.get_pathsep()
local is_os = t.is_os
-local fn = t.fn
+local fn = n.fn
describe(':trust', function()
local xstate = 'Xstate'
setup(function()
- t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
+ n.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
end)
teardown(function()
- t.rmdir(xstate)
+ n.rmdir(xstate)
end)
before_each(function()
diff --git a/test/functional/ex_cmds/undojoin_spec.lua b/test/functional/ex_cmds/undojoin_spec.lua
index 90e18f6a4b..06b5973053 100644
--- a/test/functional/ex_cmds/undojoin_spec.lua
+++ b/test/functional/ex_cmds/undojoin_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local insert = t.insert
-local feed = t.feed
-local expect = t.expect
-local feed_command = t.feed_command
-local exc_exec = t.exc_exec
+local clear = n.clear
+local insert = n.insert
+local feed = n.feed
+local expect = n.expect
+local feed_command = n.feed_command
+local exc_exec = n.exc_exec
describe(':undojoin command', function()
before_each(function()
diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua
index 047edfba76..0f99552935 100644
--- a/test/functional/ex_cmds/verbose_spec.lua
+++ b/test/functional/ex_cmds/verbose_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local exec = t.exec
-local exec_capture = t.exec_capture
+local exec = n.exec
+local exec_capture = n.exec_capture
local write_file = t.write_file
-local call_viml_function = t.api.nvim_call_function
+local call_viml_function = n.api.nvim_call_function
local function last_set_tests(cmd)
local script_location, script_file
@@ -15,7 +16,7 @@ local function last_set_tests(cmd)
script_file = 'test_verbose.lua'
local current_dir = call_viml_function('getcwd', {})
current_dir = call_viml_function('fnamemodify', { current_dir, ':~' })
- script_location = table.concat { current_dir, t.get_pathsep(), script_file }
+ script_location = table.concat { current_dir, n.get_pathsep(), script_file }
write_file(
script_file,
diff --git a/test/functional/ex_cmds/wincmd_spec.lua b/test/functional/ex_cmds/wincmd_spec.lua
index b4e04b1884..283f0991cb 100644
--- a/test/functional/ex_cmds/wincmd_spec.lua
+++ b/test/functional/ex_cmds/wincmd_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local fn = t.fn
-local command = t.command
+local fn = n.fn
+local command = n.command
it(':wincmd accepts a count', function()
clear()
diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua
index dda4223a2a..bb04bfa08a 100644
--- a/test/functional/ex_cmds/write_spec.lua
+++ b/test/functional/ex_cmds/write_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq, eval, clear, write_file, source, insert =
- t.eq, t.eval, t.clear, t.write_file, t.source, t.insert
+ t.eq, n.eval, n.clear, t.write_file, n.source, n.insert
local pcall_err = t.pcall_err
-local command = t.command
-local feed_command = t.feed_command
-local fn = t.fn
-local api = t.api
+local command = n.command
+local feed_command = n.feed_command
+local fn = n.fn
+local api = n.api
local skip = t.skip
local is_os = t.is_os
local is_ci = t.is_ci
diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua
index 03621205d7..2299f33f06 100644
--- a/test/functional/ex_cmds/wundo_spec.lua
+++ b/test/functional/ex_cmds/wundo_spec.lua
@@ -1,8 +1,13 @@
-- Specs for :wundo and underlying functions
-local t = require('test.functional.testutil')()
-local command, clear, eval, spawn, nvim_prog, set_session =
- t.command, t.clear, t.eval, t.spawn, t.nvim_prog, t.set_session
+local n = require('test.functional.testnvim')()
+
+local command = n.command
+local clear = n.clear
+local eval = n.eval
+local spawn = n.spawn
+local nvim_prog = n.nvim_prog
+local set_session = n.set_session
describe(':wundo', function()
before_each(clear)
diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua
index f704239c57..7c76d92228 100644
--- a/test/functional/ex_cmds/wviminfo_spec.lua
+++ b/test/functional/ex_cmds/wviminfo_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command, eq, neq, write_file = t.command, t.eq, t.neq, t.write_file
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command, eq, neq, write_file = n.command, t.eq, t.neq, t.write_file
local read_file = t.read_file
local is_os = t.is_os
diff --git a/test/functional/example_spec.lua b/test/functional/example_spec.lua
index a424d6a1fe..8db5c3d867 100644
--- a/test/functional/example_spec.lua
+++ b/test/functional/example_spec.lua
@@ -1,12 +1,13 @@
-- To run this test:
-- TEST_FILE=test/functional/example_spec.lua make functionaltest
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local feed = t.feed
+local feed = n.feed
describe('example', function()
local screen
diff --git a/test/functional/legacy/002_filename_recognition_spec.lua b/test/functional/legacy/002_filename_recognition_spec.lua
index c29e5febcf..dd1335df94 100644
--- a/test/functional/legacy/002_filename_recognition_spec.lua
+++ b/test/functional/legacy/002_filename_recognition_spec.lua
@@ -1,9 +1,10 @@
-- Test if URLs are recognized as filenames by commands such as "gf". Here
-- we'll use `expand("<cfile>")` since "gf" would need to open the file.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('filename recognition', function()
setup(clear)
diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
index 0ba6df5afc..6865153452 100644
--- a/test/functional/legacy/004_bufenter_with_modelines_spec.lua
+++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
@@ -1,9 +1,10 @@
-- Test for autocommand that changes current buffer on BufEnter event.
-- Check if modelines are interpreted for the correct buffer.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('BufEnter with modelines', function()
setup(clear)
diff --git a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
index 6da7c05244..4d2d06f942 100644
--- a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
+++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
@@ -1,10 +1,11 @@
-- Test for autocommand that deletes the current buffer on BufLeave event.
-- Also test deleting the last buffer, should give a new, empty buffer.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, expect = t.command, t.expect
-local poke_eventloop = t.poke_eventloop
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, expect = n.command, n.expect
+local poke_eventloop = n.poke_eventloop
describe('test5', function()
setup(clear)
diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua
index 3b094583ac..15f3b0b9b8 100644
--- a/test/functional/legacy/007_ball_buffer_list_spec.lua
+++ b/test/functional/legacy/007_ball_buffer_list_spec.lua
@@ -1,8 +1,9 @@
-- Test for autocommand that changes the buffer list, when doing ":ball".
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe(':ball', function()
setup(clear)
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 8978508fd7..b7b411d631 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -1,12 +1,14 @@
-- Test for BufWritePre autocommand that deletes or unloads the buffer.
-- Test for BufUnload autocommand that unloads all other buffers.
-local t = require('test.functional.testutil')()
-local source = t.source
-local clear, command, expect, eq, eval = t.clear, t.command, t.expect, t.eq, t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local source = n.source
+local clear, command, expect, eq, eval = n.clear, n.command, n.expect, t.eq, n.eval
local write_file, dedent = t.write_file, t.dedent
local read_file = t.read_file
-local expect_exit = t.expect_exit
+local expect_exit = n.expect_exit
describe('autocommands that delete and unload buffers:', function()
local test_file = 'Xtest-008_autocommands.out'
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 4ac495cec4..45965d8791 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -12,10 +12,12 @@
-- Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz"
-- being modified outside of Vim (noticed on Solaris).
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
- t.clear, t.feed_command, t.expect, t.eq, t.neq, t.dedent, t.write_file, t.feed
-local command = t.command
+ n.clear, n.feed_command, n.expect, t.eq, t.neq, t.dedent, t.write_file, n.feed
+local command = n.command
local read_file = t.read_file
local is_os = t.is_os
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index ef3d77e8d2..5c9185982f 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -3,18 +3,19 @@
-- - "./dir", in directory relative to file
-- - "dir", in directory relative to current dir
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
local neq = t.neq
-local poke_eventloop = t.poke_eventloop
-local fn = t.fn
-local api = t.api
-local clear = t.clear
-local insert = t.insert
-local command = t.command
+local poke_eventloop = n.poke_eventloop
+local fn = n.fn
+local api = n.api
+local clear = n.clear
+local insert = n.insert
+local command = n.command
local write_file = t.write_file
-local expect_exit = t.expect_exit
+local expect_exit = n.expect_exit
local mkdir = t.mkdir
local function ls_dir_sorted(dirname)
@@ -44,8 +45,8 @@ describe("'directory' option", function()
end)
teardown(function()
expect_exit(command, 'qall!')
- t.rmdir('Xtest.je')
- t.rmdir('Xtest2')
+ n.rmdir('Xtest.je')
+ n.rmdir('Xtest2')
os.remove('Xtest1')
end)
diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua
index df4e2cdf9c..ac90f3f98b 100644
--- a/test/functional/legacy/015_alignment_spec.lua
+++ b/test/functional/legacy/015_alignment_spec.lua
@@ -2,9 +2,10 @@
-- Also test formatting a paragraph.
-- Also test undo after ":%s" and formatting.
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('alignment', function()
setup(clear)
diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua
index 50b45418ce..851b3264d3 100644
--- a/test/functional/legacy/018_unset_smart_indenting_spec.lua
+++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua
@@ -1,12 +1,12 @@
-- Tests for not doing smart indenting when it isn't set.
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local feed = t.feed
-local clear = t.clear
-local insert = t.insert
-local expect = t.expect
-local feed_command = t.feed_command
+local feed = n.feed
+local clear = n.clear
+local insert = n.insert
+local expect = n.expect
+local feed_command = n.feed_command
describe('unset smart indenting', function()
before_each(clear)
diff --git a/test/functional/legacy/019_smarttab_expandtab_spec.lua b/test/functional/legacy/019_smarttab_expandtab_spec.lua
index e7c16207d4..3bdc76c220 100644
--- a/test/functional/legacy/019_smarttab_expandtab_spec.lua
+++ b/test/functional/legacy/019_smarttab_expandtab_spec.lua
@@ -1,9 +1,10 @@
-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
-- Also test that dv_ works correctly
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
setup(clear)
diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua
index eb2ad56dbc..f8df3dbf7e 100644
--- a/test/functional/legacy/020_blockwise_visual_spec.lua
+++ b/test/functional/legacy/020_blockwise_visual_spec.lua
@@ -2,9 +2,10 @@
-- First test for undo working properly when executing commands from a register.
-- Also test this in an empty buffer.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('blockwise visual', function()
setup(clear)
diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua
index b0d7a654f3..64dbc47201 100644
--- a/test/functional/legacy/021_control_wi_spec.lua
+++ b/test/functional/legacy/021_control_wi_spec.lua
@@ -1,8 +1,9 @@
-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('CTRL-W CTRL-I', function()
setup(clear)
diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua
index 14037db82d..97dc5b0153 100644
--- a/test/functional/legacy/023_edit_arguments_spec.lua
+++ b/test/functional/legacy/023_edit_arguments_spec.lua
@@ -1,9 +1,10 @@
-- Tests for complicated + argument to :edit command
-local t = require('test.functional.testutil')()
-local clear, insert = t.clear, t.insert
-local command, expect = t.command, t.expect
-local poke_eventloop = t.poke_eventloop
+local n = require('test.functional.testnvim')()
+
+local clear, insert = n.clear, n.insert
+local command, expect = n.command, n.expect
+local poke_eventloop = n.poke_eventloop
describe(':edit', function()
setup(clear)
diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua
index e4e1994fe9..b7090662e6 100644
--- a/test/functional/legacy/025_jump_tag_hidden_spec.lua
+++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua
@@ -1,9 +1,11 @@
-- Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag.
-- This only works for Unix, because of the symbolic link.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('jump to a tag with hidden set', function()
setup(clear)
diff --git a/test/functional/legacy/026_execute_while_if_spec.lua b/test/functional/legacy/026_execute_while_if_spec.lua
index 721036b1df..143985c726 100644
--- a/test/functional/legacy/026_execute_while_if_spec.lua
+++ b/test/functional/legacy/026_execute_while_if_spec.lua
@@ -1,11 +1,11 @@
-- Test for :execute, :while and :if
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local expect = t.expect
-local source = t.source
-local command = t.command
+local clear = n.clear
+local expect = n.expect
+local source = n.source
+local command = n.command
describe(':execute, :while and :if', function()
setup(clear)
diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua
index 704ba6bd2e..17d4e7cc2e 100644
--- a/test/functional/legacy/028_source_ctrl_v_spec.lua
+++ b/test/functional/legacy/028_source_ctrl_v_spec.lua
@@ -1,8 +1,9 @@
-- Test for sourcing a file with CTRL-V's at the end of the line
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('CTRL-V at the end of the line', function()
setup(clear)
diff --git a/test/functional/legacy/029_join_spec.lua b/test/functional/legacy/029_join_spec.lua
index a0eb9c0f13..8d4cc70d8f 100644
--- a/test/functional/legacy/029_join_spec.lua
+++ b/test/functional/legacy/029_join_spec.lua
@@ -1,12 +1,12 @@
-- Test for joining lines with marks in them (and with 'joinspaces' set/reset)
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local feed = t.feed
-local clear = t.clear
-local insert = t.insert
-local expect = t.expect
-local feed_command = t.feed_command
+local feed = n.feed
+local clear = n.clear
+local insert = n.insert
+local expect = n.expect
+local feed_command = n.feed_command
describe('joining lines', function()
before_each(clear)
diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua
index 0053d053db..1a44ed6cb6 100644
--- a/test/functional/legacy/030_fileformats_spec.lua
+++ b/test/functional/legacy/030_fileformats_spec.lua
@@ -1,9 +1,11 @@
-- Test for a lot of variations of the 'fileformats' option
-local t = require('test.functional.testutil')()
-local feed, clear, command = t.feed, t.clear, t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local feed, clear, command = n.feed, n.clear, n.command
local eq, write_file = t.eq, t.write_file
-local poke_eventloop = t.poke_eventloop
+local poke_eventloop = n.poke_eventloop
describe('fileformats option', function()
setup(function()
@@ -254,7 +256,7 @@ describe('fileformats option', function()
command('set nobinary ff&')
-- Assert buffer contents. This has to be done manually as
- -- t.expect() calls t.dedent() which messes up the white space
+ -- n.expect() calls t.dedent() which messes up the white space
-- and carriage returns.
eq(
'unix\n'..
@@ -387,6 +389,6 @@ describe('fileformats option', function()
'10\n'..
'unix\n'..
'unix',
- t.curbuf_contents())
+ n.curbuf_contents())
end)
end)
diff --git a/test/functional/legacy/031_close_commands_spec.lua b/test/functional/legacy/031_close_commands_spec.lua
index 65abb57e42..974df0c21d 100644
--- a/test/functional/legacy/031_close_commands_spec.lua
+++ b/test/functional/legacy/031_close_commands_spec.lua
@@ -9,15 +9,15 @@
-- :buf
-- :edit
-local t = require('test.functional.testutil')()
-
-local feed = t.feed
-local clear = t.clear
-local source = t.source
-local insert = t.insert
-local expect = t.expect
-local feed_command = t.feed_command
-local expect_exit = t.expect_exit
+local n = require('test.functional.testnvim')()
+
+local feed = n.feed
+local clear = n.clear
+local source = n.source
+local insert = n.insert
+local expect = n.expect
+local feed_command = n.feed_command
+local expect_exit = n.expect_exit
describe('Commands that close windows and/or buffers', function()
local function cleanup()
diff --git a/test/functional/legacy/033_lisp_indent_spec.lua b/test/functional/legacy/033_lisp_indent_spec.lua
index 3c6da9d456..e3d06be6bf 100644
--- a/test/functional/legacy/033_lisp_indent_spec.lua
+++ b/test/functional/legacy/033_lisp_indent_spec.lua
@@ -1,10 +1,11 @@
-- Test for 'lisp'
-- If the lisp feature is not enabled, this will fail!
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, expect = t.command, t.expect
-local poke_eventloop = t.poke_eventloop
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, expect = n.command, n.expect
+local poke_eventloop = n.poke_eventloop
describe('lisp indent', function()
setup(clear)
diff --git a/test/functional/legacy/034_user_function_spec.lua b/test/functional/legacy/034_user_function_spec.lua
index d592bd8b8a..89bf3b8920 100644
--- a/test/functional/legacy/034_user_function_spec.lua
+++ b/test/functional/legacy/034_user_function_spec.lua
@@ -3,9 +3,10 @@
-- Also test that a builtin function cannot be replaced.
-- Also test for regression when calling arbitrary expression.
-local t = require('test.functional.testutil')()
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe(
'user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions',
diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua
index d3eb8d6174..b6486a8a27 100644
--- a/test/functional/legacy/035_increment_and_decrement_spec.lua
+++ b/test/functional/legacy/035_increment_and_decrement_spec.lua
@@ -1,9 +1,10 @@
-- Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal,
-- and octal numbers.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('increment and decrement commands', function()
setup(clear)
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index f948abefb7..9c871e159c 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -1,8 +1,10 @@
-- Test character classes in regexp using regexpengine 0, 1, 2.
-local t = require('test.functional.testutil')()
-local clear, command, expect = t.clear, t.command, t.expect
-local source, write_file = t.source, t.write_file
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, command, expect = n.clear, n.command, n.expect
+local source, write_file = n.source, t.write_file
local function sixlines(text)
local result = ''
@@ -15,7 +17,7 @@ end
local function diff(text, nodedent)
local fname = t.tmpname()
command('w! ' .. fname)
- t.poke_eventloop()
+ n.poke_eventloop()
local data = io.open(fname):read('*all')
if nodedent then
t.eq(text, data)
diff --git a/test/functional/legacy/038_virtual_replace_spec.lua b/test/functional/legacy/038_virtual_replace_spec.lua
index 952b90fb6d..b2edc5933f 100644
--- a/test/functional/legacy/038_virtual_replace_spec.lua
+++ b/test/functional/legacy/038_virtual_replace_spec.lua
@@ -1,8 +1,9 @@
-- Test Virtual replace mode.
-local t = require('test.functional.testutil')()
-local feed = t.feed
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed = n.feed
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('Virtual replace mode', function()
setup(clear)
diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
index cbaa466621..9fbf5ae774 100644
--- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua
+++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
@@ -1,11 +1,13 @@
-- Test Visual block mode commands
-- And test "U" in Visual mode, also on German sharp S.
-local t = require('test.functional.testutil')()
-local nvim, eq = t.api, t.eq
-local insert, feed = t.insert, t.feed
-local clear, expect = t.clear, t.expect
-local feed_command = t.feed_command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local api, eq = n.api, t.eq
+local insert, feed = n.insert, n.feed
+local clear, expect = n.clear, n.expect
+local feed_command = n.feed_command
describe('Visual block mode', function()
before_each(function()
@@ -204,7 +206,7 @@ describe('Visual block mode', function()
feed('G2l')
feed('2k<C-v>$gj<ESC>')
feed_command([[let cpos=getpos("'>")]])
- local cpos = nvim.nvim_get_var('cpos')
+ local cpos = api.nvim_get_var('cpos')
local expected = {
col = 4,
off = 0,
diff --git a/test/functional/legacy/043_magic_settings_spec.lua b/test/functional/legacy/043_magic_settings_spec.lua
index 26ccba27c6..ba4c2dab02 100644
--- a/test/functional/legacy/043_magic_settings_spec.lua
+++ b/test/functional/legacy/043_magic_settings_spec.lua
@@ -1,8 +1,9 @@
-- Tests for regexp with various magic settings.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('regexp with magic settings', function()
setup(clear)
diff --git a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
index 89c5b3cbb2..99cb64c7e5 100644
--- a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
+++ b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
@@ -3,9 +3,10 @@
--
-- This test contains both "test44" and "test99" from the old test suite.
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
-- Runs the test protocol with the given 'regexpengine' setting. In the old test
-- suite the test protocol was duplicated in test44 and test99, the only
diff --git a/test/functional/legacy/046_multi_line_regexps_spec.lua b/test/functional/legacy/046_multi_line_regexps_spec.lua
index 130f238d76..a103b55581 100644
--- a/test/functional/legacy/046_multi_line_regexps_spec.lua
+++ b/test/functional/legacy/046_multi_line_regexps_spec.lua
@@ -1,9 +1,10 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for multi-line regexps with ":s"
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local expect = t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local expect = n.expect
describe('multi-line regexp', function()
setup(clear)
diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
index ddf807a4aa..afde6f220a 100644
--- a/test/functional/legacy/054_buffer_local_autocommands_spec.lua
+++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
@@ -1,10 +1,10 @@
-- Some tests for buffer-local autocommands
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local expect = t.expect
-local command = t.command
+local clear = n.clear
+local expect = n.expect
+local command = n.command
local fname = 'Xtest-functional-legacy-054'
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
index ecde375a6b..21d6b07a2d 100644
--- a/test/functional/legacy/055_list_and_dict_types_spec.lua
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -1,8 +1,9 @@
-- Tests for List and Dictionary types.
-local t = require('test.functional.testutil')()
-local feed, source = t.feed, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, source = n.feed, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('list and dictionary types', function()
before_each(clear)
diff --git a/test/functional/legacy/056_script_local_function_spec.lua b/test/functional/legacy/056_script_local_function_spec.lua
index 50c34ce869..dd99224edb 100644
--- a/test/functional/legacy/056_script_local_function_spec.lua
+++ b/test/functional/legacy/056_script_local_function_spec.lua
@@ -1,9 +1,10 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Test for script-local function.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local expect = t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local expect = n.expect
describe('source function', function()
setup(clear)
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua
index 8fa301a861..8b0664d50c 100644
--- a/test/functional/legacy/057_sort_spec.lua
+++ b/test/functional/legacy/057_sort_spec.lua
@@ -1,10 +1,11 @@
-- Tests for :sort command.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local insert, command, clear, expect, eq, poke_eventloop =
- t.insert, t.command, t.clear, t.expect, t.eq, t.poke_eventloop
-local exc_exec = t.exc_exec
+ n.insert, n.command, n.clear, n.expect, t.eq, n.poke_eventloop
+local exc_exec = n.exc_exec
describe(':sort', function()
local text = [[
diff --git a/test/functional/legacy/060_exists_and_has_functions_spec.lua b/test/functional/legacy/060_exists_and_has_functions_spec.lua
index 2f0e6f20e0..ec29b6cf04 100644
--- a/test/functional/legacy/060_exists_and_has_functions_spec.lua
+++ b/test/functional/legacy/060_exists_and_has_functions_spec.lua
@@ -1,8 +1,10 @@
-- Tests for the exists() and has() functions.
-local t = require('test.functional.testutil')()
-local source = t.source
-local clear, expect = t.clear, t.expect
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local source = n.source
+local clear, expect = n.clear, n.expect
local write_file = t.write_file
describe('exists() and has() functions', function()
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index cadaf021e7..4177f908a1 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -1,14 +1,15 @@
-- Tests for undo tree and :earlier and :later.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local feed_command = t.feed_command
+local feed_command = n.feed_command
local write_file = t.write_file
-local command = t.command
-local source = t.source
-local expect = t.expect
-local clear = t.clear
-local feed = t.feed
-local eval = t.eval
+local command = n.command
+local source = n.source
+local expect = n.expect
+local clear = n.clear
+local feed = n.feed
+local eval = n.eval
local eq = t.eq
local function expect_empty_buffer()
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index 5a9817927b..7515bcf182 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -1,10 +1,10 @@
-- Tests for adjusting window and contents
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, command = t.clear, t.command
-local insert = t.insert
+local clear, command = n.clear, n.command
+local insert = n.insert
describe('063: Test for ":match", "matchadd()" and related functions', function()
setup(clear)
diff --git a/test/functional/legacy/065_float_and_logic_operators_spec.lua b/test/functional/legacy/065_float_and_logic_operators_spec.lua
index 6a86c6b360..0835a3df52 100644
--- a/test/functional/legacy/065_float_and_logic_operators_spec.lua
+++ b/test/functional/legacy/065_float_and_logic_operators_spec.lua
@@ -1,8 +1,9 @@
-- Test for floating point and logical operators.
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, expect = n.clear, n.expect
describe('floating point and logical operators', function()
setup(clear)
diff --git a/test/functional/legacy/066_visual_block_tab_spec.lua b/test/functional/legacy/066_visual_block_tab_spec.lua
index bd0b6eb14f..6e92bd4c65 100644
--- a/test/functional/legacy/066_visual_block_tab_spec.lua
+++ b/test/functional/legacy/066_visual_block_tab_spec.lua
@@ -1,9 +1,10 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Test for visual block shift and tab characters.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('visual block shift and tab characters', function()
setup(clear)
diff --git a/test/functional/legacy/067_augroup_exists_spec.lua b/test/functional/legacy/067_augroup_exists_spec.lua
index 65f4a9b3c2..82b9c4bfa3 100644
--- a/test/functional/legacy/067_augroup_exists_spec.lua
+++ b/test/functional/legacy/067_augroup_exists_spec.lua
@@ -1,9 +1,10 @@
-- Test that groups and patterns are tested correctly when calling exists() for
-- autocommands.
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command, expect = t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command, expect = n.command, n.expect
describe('augroup when calling exists()', function()
setup(clear)
diff --git a/test/functional/legacy/068_text_formatting_spec.lua b/test/functional/legacy/068_text_formatting_spec.lua
index ece2fb25d4..179c15fb0f 100644
--- a/test/functional/legacy/068_text_formatting_spec.lua
+++ b/test/functional/legacy/068_text_formatting_spec.lua
@@ -1,10 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local feed = t.feed
-local clear = t.clear
-local insert = t.insert
-local feed_command = t.feed_command
-local expect = t.expect
+local feed = n.feed
+local clear = n.clear
+local insert = n.insert
+local feed_command = n.feed_command
+local expect = n.expect
describe('text formatting', function()
setup(clear)
diff --git a/test/functional/legacy/069_multibyte_formatting_spec.lua b/test/functional/legacy/069_multibyte_formatting_spec.lua
index 300c915ca9..24a4692e6c 100644
--- a/test/functional/legacy/069_multibyte_formatting_spec.lua
+++ b/test/functional/legacy/069_multibyte_formatting_spec.lua
@@ -3,9 +3,11 @@
-- And test "ra" on multibyte characters.
-- Also test byteidx() and byteidxcomp()
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local feed, insert, eq, eval, clear, feed_command, expect =
- t.feed, t.insert, t.eq, t.eval, t.clear, t.feed_command, t.expect
+ n.feed, n.insert, t.eq, n.eval, n.clear, n.feed_command, n.expect
describe('multibyte text', function()
before_each(clear)
diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua
index e2785027f7..f7185dacff 100644
--- a/test/functional/legacy/072_undo_file_spec.lua
+++ b/test/functional/legacy/072_undo_file_spec.lua
@@ -2,9 +2,10 @@
-- Since this script is sourced we need to explicitly break changes up in
-- undo-able pieces. Do that by setting 'undolevels'.
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('72', function()
setup(clear)
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index fa4129b9d8..d56a2654e3 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,8 +1,10 @@
-- Tests for storing global variables in the .shada file
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local clear, command, eq, neq, eval, poke_eventloop =
- t.clear, t.command, t.eq, t.neq, t.eval, t.poke_eventloop
+ n.clear, n.command, t.eq, t.neq, n.eval, n.poke_eventloop
describe('storing global variables in ShaDa files', function()
local tempname = 'Xtest-functional-legacy-074'
diff --git a/test/functional/legacy/078_swapfile_recover_spec.lua b/test/functional/legacy/078_swapfile_recover_spec.lua
index 40970ebfdb..fa53482393 100644
--- a/test/functional/legacy/078_swapfile_recover_spec.lua
+++ b/test/functional/legacy/078_swapfile_recover_spec.lua
@@ -3,8 +3,9 @@
-- restored. We need about 10000 lines of 100 characters to get two levels of
-- pointer blocks.
-local t = require('test.functional.testutil')()
-local clear, expect, source = t.clear, t.expect, t.source
+local n = require('test.functional.testnvim')()
+
+local clear, expect, source = n.clear, n.expect, n.source
describe('78', function()
setup(clear)
diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua
index 945eb696e5..cfa65f5c8a 100644
--- a/test/functional/legacy/081_coptions_movement_spec.lua
+++ b/test/functional/legacy/081_coptions_movement_spec.lua
@@ -1,8 +1,9 @@
-- Test for t movement command and 'cpo-;' setting
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('coptions', function()
setup(clear)
diff --git a/test/functional/legacy/082_string_comparison_spec.lua b/test/functional/legacy/082_string_comparison_spec.lua
index 89c3c65a38..3d91dc4b34 100644
--- a/test/functional/legacy/082_string_comparison_spec.lua
+++ b/test/functional/legacy/082_string_comparison_spec.lua
@@ -1,9 +1,10 @@
-- Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
-- Also test "g~ap".
-local t = require('test.functional.testutil')()
-local feed, source = t.feed, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, source = n.feed, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('case-insensitive string comparison in UTF-8', function()
setup(clear)
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index 03c699cfa7..05154f660d 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -1,12 +1,14 @@
-- Tests for tag search with !_TAG_FILE_ENCODING.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local insert, source, clear, expect, write_file =
- t.insert, t.source, t.clear, t.expect, t.write_file
+ n.insert, n.source, n.clear, n.expect, t.write_file
local function has_iconv()
clear() -- ensures session
- return 1 == t.eval('has("iconv")')
+ return 1 == n.eval('has("iconv")')
end
describe('tag search with !_TAG_FILE_ENCODING', function()
diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua
index 98b15014cf..648eb65550 100644
--- a/test/functional/legacy/090_sha256_spec.lua
+++ b/test/functional/legacy/090_sha256_spec.lua
@@ -1,8 +1,9 @@
-- Tests for sha256() function.
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, expect = n.clear, n.expect
describe('sha256()', function()
setup(clear)
diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua
index fa892cb410..cc3ee6787a 100644
--- a/test/functional/legacy/091_context_variables_spec.lua
+++ b/test/functional/legacy/091_context_variables_spec.lua
@@ -1,8 +1,9 @@
-- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar().
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, expect = n.clear, n.expect
describe('context variables', function()
setup(clear)
diff --git a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
index 706bf13a1f..d478545077 100644
--- a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
+++ b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
@@ -3,9 +3,10 @@
--
-- Same as legacy test 93 but using UTF-8 file encoding.
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('store cursor position in session file in UTF-8', function()
setup(clear)
diff --git a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
index 1d513189d4..5e5e465c01 100644
--- a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
+++ b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
@@ -3,9 +3,10 @@
--
-- Same as legacy test 92 but using Latin-1 file encoding.
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('store cursor position in session file in Latin-1', function()
setup(clear)
diff --git a/test/functional/legacy/094_visual_mode_operators_spec.lua b/test/functional/legacy/094_visual_mode_operators_spec.lua
index e3f3d3cdf3..279c6a432a 100644
--- a/test/functional/legacy/094_visual_mode_operators_spec.lua
+++ b/test/functional/legacy/094_visual_mode_operators_spec.lua
@@ -4,9 +4,10 @@
-- followed by an operator and those executed via Operator-pending mode. Also
-- part of the test are mappings, counts, and repetition with the . command.
-local t = require('test.functional.testutil')()
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
-- Vim script user functions needed for some of the test cases.
local function source_user_functions()
diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua
index b62666bfd5..296bf00b58 100644
--- a/test/functional/legacy/095_regexp_multibyte_spec.lua
+++ b/test/functional/legacy/095_regexp_multibyte_spec.lua
@@ -3,9 +3,10 @@
-- A pattern that gives the expected result produces OK, so that we know it was
-- actually tried.
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, expect = n.clear, n.expect
describe('regex with multi-byte', function()
setup(clear)
diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua
index cacdc15ecb..27bbe706bb 100644
--- a/test/functional/legacy/096_location_list_spec.lua
+++ b/test/functional/legacy/096_location_list_spec.lua
@@ -6,9 +6,10 @@
-- C. make sure that the location list window is not reused instead of the window
-- it belongs to.
-local t = require('test.functional.testutil')()
-local source = t.source
-local clear, command, expect = t.clear, t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local source = n.source
+local clear, command, expect = n.clear, n.command, n.expect
describe('location list', function()
local test_file = 'Xtest-096_location_list.out'
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
index 566918bc60..4d4bb9e78f 100644
--- a/test/functional/legacy/097_glob_path_spec.lua
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -2,9 +2,11 @@
-- Test whether glob()/globpath() return correct results with certain escaped
-- characters.
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command, expect = t.command, t.expect
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command, expect = n.command, n.expect
describe('glob() and globpath()', function()
setup(clear)
diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua
index fa3ffbe180..88f1c31b23 100644
--- a/test/functional/legacy/101_hlsearch_spec.lua
+++ b/test/functional/legacy/101_hlsearch_spec.lua
@@ -1,8 +1,9 @@
-- Test for v:hlsearch
-local t = require('test.functional.testutil')()
-local clear, feed = t.clear, t.feed
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed = n.clear, n.feed
+local feed_command, expect = n.feed_command, n.expect
describe('v:hlsearch', function()
setup(clear)
diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua
index 25b4706217..f0361c2f5a 100644
--- a/test/functional/legacy/102_fnameescape_spec.lua
+++ b/test/functional/legacy/102_fnameescape_spec.lua
@@ -1,8 +1,9 @@
-- Test if fnameescape is correct for special chars like!
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command, expect = t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command, expect = n.command, n.expect
describe('fnameescape', function()
setup(clear)
diff --git a/test/functional/legacy/103_visual_mode_reset_spec.lua b/test/functional/legacy/103_visual_mode_reset_spec.lua
index e8aeb1305a..b6fdf8cc68 100644
--- a/test/functional/legacy/103_visual_mode_reset_spec.lua
+++ b/test/functional/legacy/103_visual_mode_reset_spec.lua
@@ -1,8 +1,9 @@
-- Test for visual mode not being reset causing E315 error.
-local t = require('test.functional.testutil')()
-local feed, source = t.feed, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, source = n.feed, n.source
+local clear, expect = n.clear, n.expect
describe('E315 error', function()
setup(clear)
diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua
index 4094e9209a..4189b568a2 100644
--- a/test/functional/legacy/106_errorformat_spec.lua
+++ b/test/functional/legacy/106_errorformat_spec.lua
@@ -1,8 +1,9 @@
-- Tests for errorformat.
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command, expect = t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command, expect = n.command, n.expect
describe('errorformat', function()
setup(clear)
diff --git a/test/functional/legacy/107_adjust_window_and_contents_spec.lua b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
index cc9f9947c7..57ecf76f3a 100644
--- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua
+++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
@@ -1,12 +1,12 @@
-- Tests for adjusting window and contents
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local poke_eventloop = t.poke_eventloop
-local clear = t.clear
-local insert = t.insert
-local command = t.command
+local poke_eventloop = n.poke_eventloop
+local clear = n.clear
+local insert = n.insert
+local command = n.command
describe('107', function()
setup(clear)
diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
index 924f8f0051..d2ae785813 100644
--- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua
+++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
@@ -1,9 +1,10 @@
-- Tests for backtrace debug commands.
-local t = require('test.functional.testutil')()
-local command = t.command
-local feed, clear = t.feed, t.clear
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local command = n.command
+local feed, clear = n.feed, n.clear
+local feed_command, expect = n.feed_command, n.expect
describe('108', function()
before_each(clear)
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index 9915e9fecc..ac2a39a381 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -1,10 +1,12 @@
-- Test argument list commands
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, command, eq = t.clear, t.command, t.eq
-local expect_exit = t.expect_exit
-local feed = t.feed
+
+local clear, command, eq = n.clear, n.command, t.eq
+local expect_exit = n.expect_exit
+local feed = n.feed
local pcall_err = t.pcall_err
describe('argument list commands', function()
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 3373234646..47eea5e7d5 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -1,16 +1,18 @@
-local t = require('test.functional.testutil')()
-local nvim, call = t.api, t.call
-local clear, eq = t.clear, t.eq
-local source, command = t.source, t.command
-local exc_exec = t.exc_exec
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local api, call = n.api, n.call
+local clear, eq = n.clear, t.eq
+local source, command = n.source, n.command
+local exc_exec = n.exc_exec
+local eval = n.eval
local function expected_errors(errors)
- eq(errors, nvim.nvim_get_vvar('errors'))
+ eq(errors, api.nvim_get_vvar('errors'))
end
local function expected_empty()
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end
describe('assert function:', function()
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
index 5ab502eebd..3bfa8bcd1e 100644
--- a/test/functional/legacy/autochdir_spec.lua
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eq, matches = t.clear, t.eq, t.matches
-local eval, command, call, api = t.eval, t.command, t.call, t.api
-local source, exec_capture = t.source, t.exec_capture
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, matches = n.clear, t.eq, t.matches
+local eval, command, call, api = n.eval, n.command, n.call, n.api
+local source, exec_capture = n.source, n.exec_capture
local mkdir = t.mkdir
local function expected_empty()
@@ -18,7 +20,7 @@ describe('autochdir behavior', function()
end)
after_each(function()
- t.rmdir(dir)
+ n.rmdir(dir)
end)
-- Tests vim/vim#777 without test_autochdir().
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 8cd85897ab..9a1ad991f7 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
-local nvim = t.api
-local clear, eq, neq, eval = t.clear, t.eq, t.neq, t.eval
-local api = t.api
-local curbuf = t.api.nvim_get_current_buf
-local curwin = t.api.nvim_get_current_win
-local exec_capture = t.exec_capture
-local source, command = t.source, t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, neq, eval = n.clear, t.eq, t.neq, n.eval
+local api = n.api
+local curbuf = n.api.nvim_get_current_buf
+local curwin = n.api.nvim_get_current_win
+local exec_capture = n.exec_capture
+local source, command = n.source, n.command
local function declare_hook_function()
source([[
@@ -39,7 +40,7 @@ local function init_var()
end
local function get_result()
- local ret = nvim.nvim_get_var('ret')
+ local ret = api.nvim_get_var('ret')
init_var()
return ret
end
@@ -697,24 +698,24 @@ describe('au OptionSet', function()
it('should trigger if a boolean option be set globally', function()
set_hook('autochdir')
- nvim.nvim_set_option_value('autochdir', true, { scope = 'global' })
- eq(true, nvim.nvim_get_option_value('autochdir', { scope = 'global' }))
+ api.nvim_set_option_value('autochdir', true, { scope = 'global' })
+ eq(true, api.nvim_get_option_value('autochdir', { scope = 'global' }))
expected_combination({ 'autochdir', false, '', false, true, 'global', 'setglobal' })
end)
it('should trigger if a number option be set globally', function()
set_hook('cmdheight')
- nvim.nvim_set_option_value('cmdheight', 5, { scope = 'global' })
- eq(5, nvim.nvim_get_option_value('cmdheight', { scope = 'global' }))
+ api.nvim_set_option_value('cmdheight', 5, { scope = 'global' })
+ eq(5, api.nvim_get_option_value('cmdheight', { scope = 'global' }))
expected_combination({ 'cmdheight', 1, '', 1, 5, 'global', 'setglobal' })
end)
it('should trigger if a string option be set globally', function()
set_hook('ambiwidth')
- nvim.nvim_set_option_value('ambiwidth', 'double', { scope = 'global' })
- eq('double', nvim.nvim_get_option_value('ambiwidth', { scope = 'global' }))
+ api.nvim_set_option_value('ambiwidth', 'double', { scope = 'global' })
+ eq('double', api.nvim_get_option_value('ambiwidth', { scope = 'global' }))
expected_combination({
'ambiwidth',
'single',
diff --git a/test/functional/legacy/autocmd_spec.lua b/test/functional/legacy/autocmd_spec.lua
index cf35544f17..4d82da6312 100644
--- a/test/functional/legacy/autocmd_spec.lua
+++ b/test/functional/legacy/autocmd_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local write_file = t.write_file
-local command = t.command
-local feed = t.feed
-local api = t.api
+local command = n.command
+local feed = n.feed
+local api = n.api
local eq = t.eq
before_each(clear)
diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua
index 0f14113602..9a240c8bda 100644
--- a/test/functional/legacy/autoformat_join_spec.lua
+++ b/test/functional/legacy/autoformat_join_spec.lua
@@ -1,9 +1,10 @@
-- Tests for setting the '[,'] marks when joining lines.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, expect = t.command, t.expect
-local poke_eventloop = t.poke_eventloop
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, expect = n.command, n.expect
+local poke_eventloop = n.poke_eventloop
describe('autoformat join', function()
setup(clear)
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index 2e32e8d5f6..8c3d73b17b 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua
index 360c73b1e8..e2f87351de 100644
--- a/test/functional/legacy/changelist_spec.lua
+++ b/test/functional/legacy/changelist_spec.lua
@@ -1,9 +1,10 @@
-- Test changelist position after splitting window
-- Set 'undolevels' to make changelist for sourced file
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('changelist', function()
setup(clear)
diff --git a/test/functional/legacy/charsearch_spec.lua b/test/functional/legacy/charsearch_spec.lua
index 20d0e1e79d..da13b61e0f 100644
--- a/test/functional/legacy/charsearch_spec.lua
+++ b/test/functional/legacy/charsearch_spec.lua
@@ -1,8 +1,9 @@
-- Test for character searches
-local t = require('test.functional.testutil')()
-local feed, insert = t.feed, t.insert
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert = n.feed, n.insert
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('charsearch', function()
setup(clear)
diff --git a/test/functional/legacy/close_count_spec.lua b/test/functional/legacy/close_count_spec.lua
index 74b01d7fa6..0a08ad9fe6 100644
--- a/test/functional/legacy/close_count_spec.lua
+++ b/test/functional/legacy/close_count_spec.lua
@@ -1,13 +1,14 @@
-- Tests for :[count]close! and :[count]hide
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local poke_eventloop = t.poke_eventloop
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
-local command = t.command
+local poke_eventloop = n.poke_eventloop
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
+local command = n.command
describe('close_count', function()
setup(clear)
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index f2a0f336c0..2e0e52117d 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
-local feed_command = t.feed_command
-local exec = t.exec
-local api = t.api
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
+local feed_command = n.feed_command
+local exec = n.exec
+local api = n.api
local pesc = vim.pesc
describe('cmdline', function()
diff --git a/test/functional/legacy/command_count_spec.lua b/test/functional/legacy/command_count_spec.lua
index c4ca46984c..a6be459a4d 100644
--- a/test/functional/legacy/command_count_spec.lua
+++ b/test/functional/legacy/command_count_spec.lua
@@ -1,8 +1,9 @@
-- Test for user command counts
-local t = require('test.functional.testutil')()
-local clear, source, expect = t.clear, t.source, t.expect
-local feed_command = t.feed_command
+local n = require('test.functional.testnvim')()
+
+local clear, source, expect = n.clear, n.source, n.expect
+local feed_command = n.feed_command
-- luacheck: ignore 613 (Trailing whitespace in a string)
describe('command_count', function()
diff --git a/test/functional/legacy/comparators_spec.lua b/test/functional/legacy/comparators_spec.lua
index 582ec6d6dc..86df5b1c41 100644
--- a/test/functional/legacy/comparators_spec.lua
+++ b/test/functional/legacy/comparators_spec.lua
@@ -1,8 +1,10 @@
-- " Test for expression comparators.
-local t = require('test.functional.testutil')()
-local clear, eq = t.clear, t.eq
-local eval, command = t.eval, t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq = n.clear, t.eq
+local eval, command = n.eval, n.command
describe('comparators', function()
before_each(clear)
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index d53107117b..f4c1983bb7 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local feed = t.feed
-local api = t.api
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
+local api = n.api
local expect_pos = function(row, col)
- return t.eq({ row, col }, t.eval('[screenrow(), screencol()]'))
+ return t.eq({ row, col }, n.eval('[screenrow(), screencol()]'))
end
describe('Conceal', function()
diff --git a/test/functional/legacy/cpoptions_spec.lua b/test/functional/legacy/cpoptions_spec.lua
index 0acdcf2e4d..56b0e72c72 100644
--- a/test/functional/legacy/cpoptions_spec.lua
+++ b/test/functional/legacy/cpoptions_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/crash_spec.lua b/test/functional/legacy/crash_spec.lua
index fd9dd18e0e..04f77c7d4f 100644
--- a/test/functional/legacy/crash_spec.lua
+++ b/test/functional/legacy/crash_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
-local assert_alive = t.assert_alive
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local clear = n.clear
+local command = n.command
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/debugger_spec.lua b/test/functional/legacy/debugger_spec.lua
index a76cdbc043..c6f552ab51 100644
--- a/test/functional/legacy/debugger_spec.lua
+++ b/test/functional/legacy/debugger_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
local write_file = t.write_file
before_each(clear)
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index 82958f3bde..f8e761c7f0 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, source = t.clear, t.source
-local eq, eval, command = t.eq, t.eval, t.command
-local exc_exec = t.exc_exec
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, source = n.clear, n.source
+local eq, eval, command = t.eq, n.eval, n.command
+local exc_exec = n.exc_exec
describe('Test for delete()', function()
before_each(clear)
diff --git a/test/functional/legacy/digraph_spec.lua b/test/functional/legacy/digraph_spec.lua
index 687f5520b7..ed1071079c 100644
--- a/test/functional/legacy/digraph_spec.lua
+++ b/test/functional/legacy/digraph_spec.lua
@@ -1,7 +1,8 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
+
+local clear = n.clear
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua
index f547a8b637..98b9596847 100644
--- a/test/functional/legacy/display_spec.lua
+++ b/test/functional/legacy/display_spec.lua
@@ -1,10 +1,10 @@
-local t = require('test.functional.testutil')()
-
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local command = t.command
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local command = n.command
describe('display', function()
before_each(clear)
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
index 0def49b85d..f3d18a2541 100644
--- a/test/functional/legacy/edit_spec.lua
+++ b/test/functional/legacy/edit_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local expect = t.expect
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local expect = n.expect
+local feed = n.feed
local sleep = vim.uv.sleep
before_each(clear)
diff --git a/test/functional/legacy/erasebackword_spec.lua b/test/functional/legacy/erasebackword_spec.lua
index cd26edf29d..3042c52784 100644
--- a/test/functional/legacy/erasebackword_spec.lua
+++ b/test/functional/legacy/erasebackword_spec.lua
@@ -1,7 +1,8 @@
-- Test for CTRL-W in Insert mode
-local t = require('test.functional.testutil')()
-local clear, feed, expect = t.clear, t.feed, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, expect = n.clear, n.feed, n.expect
describe('CTRL-W in Insert mode', function()
setup(clear)
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 5e269bbef5..554af9418d 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -1,12 +1,14 @@
-- Test for various eval features.
-local t = require('test.functional.testutil')()
-local assert_alive = t.assert_alive
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, command, expect = t.clear, t.command, t.expect
-local eq, eval, write_file = t.eq, t.eval, t.write_file
-local poke_eventloop = t.poke_eventloop
-local exc_exec = t.exc_exec
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, command, expect = n.clear, n.command, n.expect
+local eq, eval, write_file = t.eq, n.eval, t.write_file
+local poke_eventloop = n.poke_eventloop
+local exc_exec = n.exc_exec
local dedent = t.dedent
describe('eval', function()
diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua
index 6914a3a3ad..574c3e4069 100644
--- a/test/functional/legacy/ex_mode_spec.lua
+++ b/test/functional/legacy/ex_mode_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local api = t.api
-local poke_eventloop = t.poke_eventloop
+local eval = n.eval
+local feed = n.feed
+local api = n.api
+local poke_eventloop = n.poke_eventloop
before_each(clear)
diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua
index 3404ebe098..de3d498f27 100644
--- a/test/functional/legacy/excmd_spec.lua
+++ b/test/functional/legacy/excmd_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local exec_lua = t.exec_lua
-local expect_exit = t.expect_exit
-local feed = t.feed
-local fn = t.fn
-local api = t.api
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local exec_lua = n.exec_lua
+local expect_exit = n.expect_exit
+local feed = n.feed
+local fn = n.fn
+local api = n.api
local read_file = t.read_file
-local source = t.source
+local source = n.source
local eq = t.eq
local write_file = t.write_file
local is_os = t.is_os
diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua
index 89bc3b78c9..21f0b9f001 100644
--- a/test/functional/legacy/fixeol_spec.lua
+++ b/test/functional/legacy/fixeol_spec.lua
@@ -1,8 +1,9 @@
-- Tests for 'fixeol'
-local t = require('test.functional.testutil')()
-local feed = t.feed
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed = n.feed
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('fixeol', function()
local function rmtestfiles()
diff --git a/test/functional/legacy/fnamemodify_spec.lua b/test/functional/legacy/fnamemodify_spec.lua
index a535ca3dba..ce8c710a46 100644
--- a/test/functional/legacy/fnamemodify_spec.lua
+++ b/test/functional/legacy/fnamemodify_spec.lua
@@ -1,11 +1,13 @@
-- Test filename modifiers.
-local t = require('test.functional.testutil')()
-local clear, source = t.clear, t.source
-local call, eq, nvim = t.call, t.eq, t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, source = n.clear, n.source
+local call, eq, api = n.call, t.eq, n.api
local function expected_empty()
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end
describe('filename modifiers', function()
diff --git a/test/functional/legacy/fold_spec.lua b/test/functional/legacy/fold_spec.lua
index 91d7c1cfcd..4fea1ef113 100644
--- a/test/functional/legacy/fold_spec.lua
+++ b/test/functional/legacy/fold_spec.lua
@@ -1,16 +1,17 @@
-- Tests for folding.
+
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local feed, insert, feed_command, expect_any = t.feed, t.insert, t.feed_command, t.expect_any
-local command = t.command
-local exec = t.exec
+local feed, insert, feed_command, expect_any = n.feed, n.insert, n.feed_command, n.expect_any
+local command = n.command
+local exec = n.exec
describe('folding', function()
local screen
before_each(function()
- t.clear()
+ n.clear()
screen = Screen.new(45, 8)
screen:attach()
@@ -60,7 +61,7 @@ describe('folding', function()
feed('kYpj')
feed_command('call append("$", foldlevel("."))')
- t.poke_eventloop()
+ n.poke_eventloop()
screen:expect([[
dd {{{ |
ee {{{ }}} |
@@ -86,7 +87,7 @@ describe('folding', function()
feed_command('call append("$", foldlevel(2))')
feed('zR')
- t.poke_eventloop()
+ n.poke_eventloop()
screen:expect([[
aa |
bb |
diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua
index e820d20918..b55c5437ef 100644
--- a/test/functional/legacy/function_sort_spec.lua
+++ b/test/functional/legacy/function_sort_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
local neq = t.neq
-local eval = t.eval
-local clear = t.clear
-local source = t.source
-local exc_exec = t.exc_exec
+local eval = n.eval
+local clear = n.clear
+local source = n.source
+local exc_exec = n.exc_exec
describe('sort', function()
before_each(clear)
diff --git a/test/functional/legacy/getcwd_spec.lua b/test/functional/legacy/getcwd_spec.lua
index 542bfefb89..c95a010c5a 100644
--- a/test/functional/legacy/getcwd_spec.lua
+++ b/test/functional/legacy/getcwd_spec.lua
@@ -1,14 +1,16 @@
-- Tests for getcwd(), haslocaldir(), and :lcd
-local t = require('test.functional.testutil')()
-local eq, eval, source = t.eq, t.eval, t.source
-local call, clear, command = t.call, t.clear, t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, eval, source = t.eq, n.eval, n.source
+local call, clear, command = n.call, n.clear, n.command
describe('getcwd', function()
before_each(clear)
after_each(function()
- t.rmdir('Xtopdir')
+ n.rmdir('Xtopdir')
end)
it('is working', function()
diff --git a/test/functional/legacy/gf_spec.lua b/test/functional/legacy/gf_spec.lua
index 37722a88bc..4c98edf8e0 100644
--- a/test/functional/legacy/gf_spec.lua
+++ b/test/functional/legacy/gf_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua
index 47205a6383..6d08a77386 100644
--- a/test/functional/legacy/glob2regpat_spec.lua
+++ b/test/functional/legacy/glob2regpat_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local eq, eval = t.eq, t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local eq, eval = t.eq, n.eval
describe('glob2regpat()', function()
before_each(clear)
diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua
index c22529b3d5..718fd421b0 100644
--- a/test/functional/legacy/global_spec.lua
+++ b/test/functional/legacy/global_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local poke_eventloop = t.poke_eventloop
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local poke_eventloop = n.poke_eventloop
before_each(clear)
diff --git a/test/functional/legacy/highlight_spec.lua b/test/functional/legacy/highlight_spec.lua
index a2e6bd2c1f..35afd9bb4a 100644
--- a/test/functional/legacy/highlight_spec.lua
+++ b/test/functional/legacy/highlight_spec.lua
@@ -1,12 +1,14 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local clear, feed = t.clear, t.feed
-local expect = t.expect
+
+local clear, feed = n.clear, n.feed
+local expect = n.expect
local eq = t.eq
-local poke_eventloop = t.poke_eventloop
-local exc_exec = t.exc_exec
-local feed_command = t.feed_command
-local exec = t.exec
+local poke_eventloop = n.poke_eventloop
+local exc_exec = n.exc_exec
+local feed_command = n.feed_command
+local exec = n.exec
before_each(clear)
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
index 8aae9dc698..c9c2324c42 100644
--- a/test/functional/legacy/increment_spec.lua
+++ b/test/functional/legacy/increment_spec.lua
@@ -1,9 +1,11 @@
-- Tests for using Ctrl-A/Ctrl-X on visual selections
-local t = require('test.functional.testutil')()
-local source, command = t.source, t.command
-local call, clear = t.call, t.clear
-local eq, nvim = t.eq, t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local source, command = n.source, n.command
+local call, clear = n.call, n.clear
+local eq, api = t.eq, n.api
describe('Ctrl-A/Ctrl-X on visual selections', function()
before_each(function()
@@ -743,18 +745,18 @@ describe('Ctrl-A/Ctrl-X on visual selections', function()
it('works on Test ' .. id, function()
command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_visual_increment_' .. id)
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end)
end
it('does not drop leading zeroes', function()
command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_normal_increment_01')
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end)
it('maintains correct column after CTRL-A', function()
call('Test_normal_increment_02')
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end)
end)
diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua
index 68d88cfc2d..53402c2163 100644
--- a/test/functional/legacy/insertcount_spec.lua
+++ b/test/functional/legacy/insertcount_spec.lua
@@ -1,8 +1,9 @@
-- Tests for repeating insert and replace.
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect = t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect = n.feed_command, n.expect
describe('insertcount', function()
setup(clear)
diff --git a/test/functional/legacy/join_spec.lua b/test/functional/legacy/join_spec.lua
index 8a182efb03..397a714b2f 100644
--- a/test/functional/legacy/join_spec.lua
+++ b/test/functional/legacy/join_spec.lua
@@ -1,8 +1,10 @@
-- Test for joining lines
-local t = require('test.functional.testutil')()
-local clear, eq = t.clear, t.eq
-local eval, command = t.eval, t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq = n.clear, t.eq
+local eval, command = n.eval, n.command
describe('joining lines', function()
before_each(clear)
diff --git a/test/functional/legacy/lispwords_spec.lua b/test/functional/legacy/lispwords_spec.lua
index f9535266de..b0130320ed 100644
--- a/test/functional/legacy/lispwords_spec.lua
+++ b/test/functional/legacy/lispwords_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local command = t.command
-local source = t.source
+local eval = n.eval
+local command = n.command
+local source = n.source
describe('lispwords', function()
before_each(clear)
diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua
index c889fb9fe5..db9ec7fc9d 100644
--- a/test/functional/legacy/listchars_spec.lua
+++ b/test/functional/legacy/listchars_spec.lua
@@ -1,9 +1,10 @@
-- Tests for 'listchars' display with 'list' and :list.
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed, insert, exec = t.feed, t.insert, t.exec
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+
+local feed, insert, exec = n.feed, n.insert, n.exec
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
-- luacheck: ignore 621 (Indentation)
describe("'listchars'", function()
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua
index 89f6c43019..da641c3b6f 100644
--- a/test/functional/legacy/listlbr_spec.lua
+++ b/test/functional/legacy/listlbr_spec.lua
@@ -1,9 +1,10 @@
-- Test for linebreak and list option (non-utf8)
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('listlbr', function()
before_each(clear)
diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua
index f912aee5aa..74cc594cc1 100644
--- a/test/functional/legacy/listlbr_utf8_spec.lua
+++ b/test/functional/legacy/listlbr_utf8_spec.lua
@@ -1,11 +1,12 @@
-- Test for linebreak and list option in utf-8 mode
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local source = t.source
-local feed = t.feed
-local exec = t.exec
-local clear, expect = t.clear, t.expect
+
+local source = n.source
+local feed = n.feed
+local exec = n.exec
+local clear, expect = n.clear, n.expect
describe('linebreak', function()
before_each(clear)
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index d0076a8a4a..3fc324f66a 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -1,11 +1,13 @@
-- Test for mappings and abbreviations
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local expect, poke_eventloop = t.expect, t.poke_eventloop
-local command, eq, eval, api = t.command, t.eq, t.eval, t.api
-local exec = t.exec
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local expect, poke_eventloop = n.expect, n.poke_eventloop
+local command, eq, eval, api = n.command, t.eq, n.eval, n.api
+local exec = n.exec
local sleep = vim.uv.sleep
describe('mapping', function()
diff --git a/test/functional/legacy/marks_spec.lua b/test/functional/legacy/marks_spec.lua
index e259d61dc4..fd968eb355 100644
--- a/test/functional/legacy/marks_spec.lua
+++ b/test/functional/legacy/marks_spec.lua
@@ -1,6 +1,7 @@
-local t = require('test.functional.testutil')()
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
+local n = require('test.functional.testnvim')()
+
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
describe('marks', function()
before_each(function()
diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua
index aa81862c94..0fc8708244 100644
--- a/test/functional/legacy/match_spec.lua
+++ b/test/functional/legacy/match_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index f454eee362..3841761515 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -1,9 +1,9 @@
-local t = require('test.functional.testutil')()
-
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
describe('matchparen', function()
before_each(clear)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index 894fa7bf03..87890d4c25 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -1,17 +1,19 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local eval = n.eval
local eq = t.eq
-local feed_command = t.feed_command
+local feed_command = n.feed_command
local retry = t.retry
local ok = t.ok
-local source = t.source
-local poke_eventloop = t.poke_eventloop
-local load_adjust = t.load_adjust
+local source = n.source
+local poke_eventloop = n.poke_eventloop
+local load_adjust = n.load_adjust
local write_file = t.write_file
local is_os = t.is_os
local is_ci = t.is_ci
-local is_asan = t.is_asan
+local is_asan = n.is_asan
clear()
if is_asan() then
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index ddf234e0b5..2f3693b5ad 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local feed = t.feed
-local api = t.api
-local nvim_dir = t.nvim_dir
-local assert_alive = t.assert_alive
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local nvim_dir = n.nvim_dir
+local assert_alive = n.assert_alive
before_each(clear)
diff --git a/test/functional/legacy/mksession_spec.lua b/test/functional/legacy/mksession_spec.lua
index fbb016008b..28d4637954 100644
--- a/test/functional/legacy/mksession_spec.lua
+++ b/test/functional/legacy/mksession_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
-local fn = t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
+local fn = n.fn
local eq = t.eq
describe('mksession', function()
diff --git a/test/functional/legacy/move_spec.lua b/test/functional/legacy/move_spec.lua
index 1ad980e08f..c2be8bb3eb 100644
--- a/test/functional/legacy/move_spec.lua
+++ b/test/functional/legacy/move_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
-local fn = t.fn
+
+local clear = n.clear
+local feed = n.feed
+local fn = n.fn
before_each(clear)
diff --git a/test/functional/legacy/nested_function_spec.lua b/test/functional/legacy/nested_function_spec.lua
index 2bff8390c1..5e981b5862 100644
--- a/test/functional/legacy/nested_function_spec.lua
+++ b/test/functional/legacy/nested_function_spec.lua
@@ -1,8 +1,9 @@
-- Tests for nested function.
-local t = require('test.functional.testutil')()
-local clear, insert = t.clear, t.insert
-local command, expect, source = t.command, t.expect, t.source
+local n = require('test.functional.testnvim')()
+
+local clear, insert = n.clear, n.insert
+local command, expect, source = n.command, n.expect, n.source
describe('test_nested_function', function()
setup(clear)
diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua
index 43019d4216..5158ca3009 100644
--- a/test/functional/legacy/normal_spec.lua
+++ b/test/functional/legacy/normal_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local api = t.api
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local api = n.api
local eq = t.eq
-local fn = t.fn
+local fn = n.fn
describe('normal', function()
local screen
diff --git a/test/functional/legacy/number_spec.lua b/test/functional/legacy/number_spec.lua
index 7a41e2af86..0ebd731f65 100644
--- a/test/functional/legacy/number_spec.lua
+++ b/test/functional/legacy/number_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
describe("'number' and 'relativenumber'", function()
before_each(clear)
diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua
index a3f6e00c83..e9a3b73cf7 100644
--- a/test/functional/legacy/options_spec.lua
+++ b/test/functional/legacy/options_spec.lua
@@ -1,11 +1,13 @@
-- See also: test/old/testdir/test_options.vim
-local t = require('test.functional.testutil')()
-local command, clear = t.command, t.clear
-local source, expect = t.source, t.expect
-local exc_exec = t.exc_exec
-local matches = t.matches
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local command, clear = n.command, n.clear
+local source, expect = n.source, n.expect
+local exc_exec = n.exc_exec
+local matches = t.matches
+
describe('options', function()
setup(clear)
diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua
index dfabfd9645..72ec420b15 100644
--- a/test/functional/legacy/prompt_buffer_spec.lua
+++ b/test/functional/legacy/prompt_buffer_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
-local source = t.source
-local clear = t.clear
-local command = t.command
-local expect = t.expect
-local poke_eventloop = t.poke_eventloop
-local api = t.api
+
+local feed = n.feed
+local source = n.source
+local clear = n.clear
+local command = n.command
+local expect = n.expect
+local poke_eventloop = n.poke_eventloop
+local api = n.api
local eq = t.eq
local neq = t.neq
diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua
index 2030d2805b..587424da10 100644
--- a/test/functional/legacy/put_spec.lua
+++ b/test/functional/legacy/put_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec_lua = t.exec_lua
-local api = t.api
-local source = t.source
+
+local clear = n.clear
+local exec_lua = n.exec_lua
+local api = n.api
+local source = n.source
local eq = t.eq
local function sizeoflong()
diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua
index e9b49fad50..26b096d633 100644
--- a/test/functional/legacy/qf_title_spec.lua
+++ b/test/functional/legacy/qf_title_spec.lua
@@ -1,8 +1,9 @@
-- Tests for quickfix window's title
-local t = require('test.functional.testutil')()
-local insert, source = t.insert, t.source
-local clear, expect = t.clear, t.expect
+local n = require('test.functional.testnvim')()
+
+local insert, source = n.insert, n.source
+local clear, expect = n.clear, n.expect
describe('qf_title', function()
setup(clear)
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index c6880b5a0e..80b8e72aec 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local assert_alive = t.assert_alive
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local assert_alive = n.assert_alive
before_each(clear)
diff --git a/test/functional/legacy/search_mbyte_spec.lua b/test/functional/legacy/search_mbyte_spec.lua
index 632d95b444..6457567176 100644
--- a/test/functional/legacy/search_mbyte_spec.lua
+++ b/test/functional/legacy/search_mbyte_spec.lua
@@ -1,10 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local poke_eventloop = t.poke_eventloop
-local clear = t.clear
-local insert = t.insert
-local expect = t.expect
-local command = t.command
+local poke_eventloop = n.poke_eventloop
+local clear = n.clear
+local insert = n.insert
+local expect = n.expect
+local command = n.command
describe('search_mbyte', function()
before_each(clear)
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index cc8f775056..d421a96579 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local fn = t.fn
-local poke_eventloop = t.poke_eventloop
-local exec = t.exec
+local eval = n.eval
+local feed = n.feed
+local fn = n.fn
+local poke_eventloop = n.poke_eventloop
+local exec = n.exec
describe('search cmdline', function()
local screen
diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua
index b71a48fff2..7779b8bef1 100644
--- a/test/functional/legacy/search_stat_spec.lua
+++ b/test/functional/legacy/search_stat_spec.lua
@@ -1,6 +1,7 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, exec, command = t.clear, t.feed, t.exec, t.command
+
+local clear, feed, exec, command = n.clear, n.feed, n.exec, n.command
describe('search stat', function()
local screen
diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua
index e58d34acd9..614673ee3c 100644
--- a/test/functional/legacy/signs_spec.lua
+++ b/test/functional/legacy/signs_spec.lua
@@ -1,7 +1,8 @@
-- Tests for signs
-local t = require('test.functional.testutil')()
-local clear, command, expect = t.clear, t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, command, expect = n.clear, n.command, n.expect
describe('signs', function()
setup(clear)
diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua
index 31ae4ed9b8..a910dc3d43 100644
--- a/test/functional/legacy/source_spec.lua
+++ b/test/functional/legacy/source_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
+
+local clear = n.clear
+local feed = n.feed
local write_file = t.write_file
before_each(clear)
diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua
index ba7376ff1b..148166fdc3 100644
--- a/test/functional/legacy/statusline_spec.lua
+++ b/test/functional/legacy/statusline_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/substitute_spec.lua b/test/functional/legacy/substitute_spec.lua
index d540a7fdeb..647d62782c 100644
--- a/test/functional/legacy/substitute_spec.lua
+++ b/test/functional/legacy/substitute_spec.lua
@@ -2,12 +2,14 @@
-- Test for submatch() on substitute().
-- Test for *:s%* on :substitute.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed, insert = t.feed, t.insert
-local exec = t.exec
-local clear, feed_command, expect = t.clear, t.feed_command, t.expect
-local eq, eval = t.eq, t.eval
+
+local feed, insert = n.feed, n.insert
+local exec = n.exec
+local clear, feed_command, expect = n.clear, n.feed_command, n.expect
+local eq, eval = t.eq, n.eval
describe('substitute()', function()
before_each(clear)
diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua
index 13b3752ff4..155eb9ce11 100644
--- a/test/functional/legacy/syn_attr_spec.lua
+++ b/test/functional/legacy/syn_attr_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
-- oldtest: Test_missing_attr()
describe('synIDattr()', function()
diff --git a/test/functional/legacy/tabline_spec.lua b/test/functional/legacy/tabline_spec.lua
index da8a525b6d..4ce32f2fdd 100644
--- a/test/functional/legacy/tabline_spec.lua
+++ b/test/functional/legacy/tabline_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/legacy/tagcase_spec.lua b/test/functional/legacy/tagcase_spec.lua
index 54251aad1c..e5bdd4658a 100644
--- a/test/functional/legacy/tagcase_spec.lua
+++ b/test/functional/legacy/tagcase_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local exc_exec = t.exc_exec
-local expect = t.expect
-local insert = t.insert
-local source = t.source
+local eval = n.eval
+local exc_exec = n.exc_exec
+local expect = n.expect
+local insert = n.insert
+local source = n.source
local write_file = t.write_file
describe("'tagcase' option", function()
diff --git a/test/functional/legacy/textobjects_spec.lua b/test/functional/legacy/textobjects_spec.lua
index 52986e6be0..9ed8716bff 100644
--- a/test/functional/legacy/textobjects_spec.lua
+++ b/test/functional/legacy/textobjects_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
-local call = t.call
-local clear = t.clear
-local command = t.command
-local expect = t.expect
-local source = t.source
+local n = require('test.functional.testnvim')()
+
+local call = n.call
+local clear = n.clear
+local command = n.command
+local expect = n.expect
+local source = n.source
describe('Text object', function()
before_each(function()
diff --git a/test/functional/legacy/undolevels_spec.lua b/test/functional/legacy/undolevels_spec.lua
index 1968f8c599..8453921669 100644
--- a/test/functional/legacy/undolevels_spec.lua
+++ b/test/functional/legacy/undolevels_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local source, clear = t.source, t.clear
-local eq, nvim = t.eq, t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local source, clear = n.source, n.clear
+local eq, api = t.eq, n.api
describe('undolevel', function()
setup(clear)
@@ -57,6 +59,6 @@ describe('undolevel', function()
call Test_global_local_undolevels()
]])
- eq({}, nvim.nvim_get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end)
end)
diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua
index 8213986c62..cdb0c2ca58 100644
--- a/test/functional/legacy/utf8_spec.lua
+++ b/test/functional/legacy/utf8_spec.lua
@@ -1,11 +1,13 @@
-- Tests for Unicode manipulations
-local t = require('test.functional.testutil')()
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, expect = t.command, t.expect
-local eq, eval = t.eq, t.eval
-local source = t.source
-local poke_eventloop = t.poke_eventloop
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, expect = n.command, n.expect
+local eq, eval = t.eq, n.eval
+local source = n.source
+local poke_eventloop = n.poke_eventloop
describe('utf8', function()
before_each(clear)
diff --git a/test/functional/legacy/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua
index 494860932e..66054810a6 100644
--- a/test/functional/legacy/vimscript_spec.lua
+++ b/test/functional/legacy/vimscript_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local api = t.api
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local api = n.api
before_each(clear)
diff --git a/test/functional/legacy/visual_spec.lua b/test/functional/legacy/visual_spec.lua
index 9fa22c7d87..ab2213b2fc 100644
--- a/test/functional/legacy/visual_spec.lua
+++ b/test/functional/legacy/visual_spec.lua
@@ -1,9 +1,9 @@
-local t = require('test.functional.testutil')()
-
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
-local exec = t.exec
+
+local clear = n.clear
+local feed = n.feed
+local exec = n.exec
before_each(clear)
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index 8fcb9fd53e..332240d04a 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local exec_lua = t.exec_lua
-local command = t.command
-local feed = t.feed
+
+local clear = n.clear
+local exec = n.exec
+local exec_lua = n.exec_lua
+local command = n.command
+local feed = n.feed
-- oldtest: Test_window_cmd_ls0_split_scrolling()
it('scrolling with laststatus=0 and :botright split', function()
diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua
index 946668e2d3..85f2a1623c 100644
--- a/test/functional/legacy/wordcount_spec.lua
+++ b/test/functional/legacy/wordcount_spec.lua
@@ -1,10 +1,12 @@
-- Test for wordcount() function
-local t = require('test.functional.testutil')()
-local feed, insert, source = t.feed, t.insert, t.source
-local clear, command = t.clear, t.command
-local eq, eval = t.eq, t.eval
-local poke_eventloop = t.poke_eventloop
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local feed, insert, source = n.feed, n.insert, n.source
+local clear, command = n.clear, n.command
+local eq, eval = t.eq, n.eval
+local poke_eventloop = n.poke_eventloop
describe('wordcount', function()
before_each(clear)
diff --git a/test/functional/legacy/writefile_spec.lua b/test/functional/legacy/writefile_spec.lua
index 6ba3056377..a5a2c3c682 100644
--- a/test/functional/legacy/writefile_spec.lua
+++ b/test/functional/legacy/writefile_spec.lua
@@ -1,7 +1,8 @@
-- Tests for writefile()
-local t = require('test.functional.testutil')()
-local clear, command, expect = t.clear, t.command, t.expect
+local n = require('test.functional.testnvim')()
+
+local clear, command, expect = n.clear, n.command, n.expect
describe('writefile', function()
setup(clear)
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index a9bcb05c16..56969150bd 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -1,14 +1,15 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local exc_exec = t.exc_exec
+local exc_exec = n.exc_exec
local remove_trace = t.remove_trace
-local fn = t.fn
-local clear = t.clear
-local eval = t.eval
+local fn = n.fn
+local clear = n.clear
+local eval = n.eval
local NIL = vim.NIL
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/lua/base64_spec.lua b/test/functional/lua/base64_spec.lua
index c7fbe2ad23..529f5f56e8 100644
--- a/test/functional/lua/base64_spec.lua
+++ b/test/functional/lua/base64_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local pcall_err = t.pcall_err
local matches = t.matches
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 0969c8f137..d4af7e4732 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -1,15 +1,16 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local command = t.command
-local api = t.api
-local fn = t.fn
-local clear = t.clear
+local command = n.command
+local api = n.api
+local fn = n.fn
+local clear = n.clear
local eq = t.eq
local fail = t.fail
-local exec_lua = t.exec_lua
-local feed = t.feed
+local exec_lua = n.exec_lua
+local feed = n.feed
local expect_events = t.expect_events
local write_file = t.write_file
local dedent = t.dedent
@@ -292,11 +293,11 @@ describe('lua buffer event callbacks: on_lines', function()
exec_lua(code)
command('q!')
- t.assert_alive()
+ n.assert_alive()
exec_lua(code)
command('bd!')
- t.assert_alive()
+ n.assert_alive()
end)
it('#12718 lnume', function()
@@ -965,7 +966,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
command('e! Xtest-undofile')
command('set undodir=. | set undofile')
- local ns = t.request('nvim_create_namespace', 'ns1')
+ local ns = n.request('nvim_create_namespace', 'ns1')
api.nvim_buf_set_extmark(0, ns, 0, 0, {})
eq({ '12345', 'hello world' }, api.nvim_buf_get_lines(0, 0, -1, true))
diff --git a/test/functional/lua/command_line_completion_spec.lua b/test/functional/lua/command_line_completion_spec.lua
index 4dc0356283..2ba432133b 100644
--- a/test/functional/lua/command_line_completion_spec.lua
+++ b/test/functional/lua/command_line_completion_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local get_completions = function(input, env)
return exec_lua('return {vim._expand_pat(...)}', input, env)
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index d0418fce26..57b084d3d6 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -1,21 +1,22 @@
-- Test suite for checking :lua* commands
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
local NIL = vim.NIL
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
local matches = t.matches
-local api = t.api
-local exec_lua = t.exec_lua
-local exec_capture = t.exec_capture
-local fn = t.fn
-local source = t.source
+local api = n.api
+local exec_lua = n.exec_lua
+local exec_capture = n.exec_capture
+local fn = n.fn
+local source = n.source
local dedent = t.dedent
-local command = t.command
-local exc_exec = t.exc_exec
+local command = n.command
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
local write_file = t.write_file
local remove_trace = t.remove_trace
diff --git a/test/functional/lua/comment_spec.lua b/test/functional/lua/comment_spec.lua
index df7776d928..9b1d9613cb 100644
--- a/test/functional/lua/comment_spec.lua
+++ b/test/functional/lua/comment_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local api = t.api
-local clear = t.clear
+local api = n.api
+local clear = n.clear
local eq = t.eq
-local exec_capture = t.exec_capture
-local exec_lua = t.exec_lua
-local feed = t.feed
+local exec_capture = n.exec_capture
+local exec_lua = n.exec_lua
+local feed = n.feed
-- Reference text
-- aa
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index be3d55089b..f36a676ba9 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local NIL = vim.NIL
-local command = t.command
-local clear = t.clear
-local exec_lua = t.exec_lua
+local command = n.command
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local matches = t.matches
-local api = t.api
+local api = n.api
local pcall_err = t.pcall_err
-local fn = t.fn
+local fn = n.fn
describe('vim.diagnostic', function()
before_each(function()
@@ -1891,12 +1892,12 @@ describe('vim.diagnostic', function()
it('respects legacy signs placed with :sign define or sign_define #26618', function()
-- Legacy signs for diagnostics were deprecated in 0.10 and will be removed in 0.12
- eq(0, t.fn.has('nvim-0.12'))
+ eq(0, n.fn.has('nvim-0.12'))
- t.command('sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg')
- t.command('sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg')
- t.command('sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined')
- t.command('sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined')
+ n.command('sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg')
+ n.command('sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg')
+ n.command('sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined')
+ n.command('sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined')
local result = exec_lua [[
vim.diagnostic.config({
diff --git a/test/functional/lua/ffi_spec.lua b/test/functional/lua/ffi_spec.lua
index 77095fac7a..85ca264107 100644
--- a/test/functional/lua/ffi_spec.lua
+++ b/test/functional/lua/ffi_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
-local exec_lua = t.exec_lua
-local clear = t.clear
+local exec_lua = n.exec_lua
+local clear = n.clear
before_each(clear)
diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua
index ffd2a7eb60..7db04e6f6b 100644
--- a/test/functional/lua/filetype_spec.lua
+++ b/test/functional/lua/filetype_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local exec_lua = n.exec_lua
local eq = t.eq
-local api = t.api
-local clear = t.clear
-local pathroot = t.pathroot
-local command = t.command
+local api = n.api
+local clear = n.clear
+local pathroot = n.pathroot
+local command = n.command
local mkdir = t.mkdir
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local write_file = t.write_file
local uv = vim.uv
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua
index 01d352ef14..db6ff60e9a 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
-local mkdir_p = t.mkdir_p
-local rmdir = t.rmdir
-local nvim_dir = t.nvim_dir
+local mkdir_p = n.mkdir_p
+local rmdir = n.rmdir
+local nvim_dir = n.nvim_dir
local test_build_dir = t.paths.test_build_dir
local test_source_path = t.paths.test_source_path
-local nvim_prog = t.nvim_prog
+local nvim_prog = n.nvim_prog
local is_os = t.is_os
local mkdir = t.mkdir
diff --git a/test/functional/lua/glob_spec.lua b/test/functional/lua/glob_spec.lua
index b1408ce92e..56cd4c9bb5 100644
--- a/test/functional/lua/glob_spec.lua
+++ b/test/functional/lua/glob_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
describe('glob', function()
- before_each(t.clear)
- after_each(t.clear)
+ before_each(n.clear)
+ after_each(n.clear)
local match = function(...)
return exec_lua(
diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua
index dc62fa978c..d47afa6164 100644
--- a/test/functional/lua/highlight_spec.lua
+++ b/test/functional/lua/highlight_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local exec_lua = n.exec_lua
local eq = t.eq
local neq = t.neq
-local eval = t.eval
-local command = t.command
-local clear = t.clear
-local api = t.api
+local eval = n.eval
+local command = n.command
+local clear = n.clear
+local api = n.api
describe('vim.highlight.on_yank', function()
before_each(function()
@@ -19,7 +21,7 @@ describe('vim.highlight.on_yank', function()
vim.cmd('bwipeout!')
]])
vim.uv.sleep(10)
- t.feed('<cr>') -- avoid hang if error message exists
+ n.feed('<cr>') -- avoid hang if error message exists
eq('', eval('v:errmsg'))
end)
diff --git a/test/functional/lua/inspector_spec.lua b/test/functional/lua/inspector_spec.lua
index 3fd8daff2e..8fadba6ee8 100644
--- a/test/functional/lua/inspector_spec.lua
+++ b/test/functional/lua/inspector_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local exec_lua = n.exec_lua
local eq = t.eq
-local eval = t.eval
-local clear = t.clear
+local eval = n.eval
+local clear = n.clear
describe('vim.inspect_pos', function()
before_each(function()
diff --git a/test/functional/lua/iter_spec.lua b/test/functional/lua/iter_spec.lua
index 10a0810501..92e809d55c 100644
--- a/test/functional/lua/iter_spec.lua
+++ b/test/functional/lua/iter_spec.lua
@@ -1,4 +1,5 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+
local eq = t.eq
local matches = t.matches
local pcall_err = t.pcall_err
diff --git a/test/functional/lua/json_spec.lua b/test/functional/lua/json_spec.lua
index c1a407110c..78e1896a20 100644
--- a/test/functional/lua/json_spec.lua
+++ b/test/functional/lua/json_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/lua/loader_spec.lua b/test/functional/lua/loader_spec.lua
index 5cf060ae4b..f13e6664c5 100644
--- a/test/functional/lua/loader_spec.lua
+++ b/test/functional/lua/loader_spec.lua
@@ -1,9 +1,10 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local exec_lua = t.exec_lua
-local command = t.command
-local clear = t.clear
+local exec_lua = n.exec_lua
+local command = n.command
+local clear = n.clear
local eq = t.eq
describe('vim.loader', function()
diff --git a/test/functional/lua/loop_spec.lua b/test/functional/lua/loop_spec.lua
index f5d9a6c39b..d5c5cd3cd0 100644
--- a/test/functional/lua/loop_spec.lua
+++ b/test/functional/lua/loop_spec.lua
@@ -1,15 +1,17 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local fn = t.fn
-local api = t.api
-local clear = t.clear
+
+local fn = n.fn
+local api = n.api
+local clear = n.clear
local sleep = vim.uv.sleep
-local feed = t.feed
+local feed = n.feed
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
local matches = t.matches
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local retry = t.retry
before_each(clear)
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 51be8798fb..3f62cd8325 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -1,17 +1,18 @@
-- Test suite for testing luaeval() function
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local pcall_err = t.pcall_err
-local exc_exec = t.exc_exec
+local exc_exec = n.exc_exec
local remove_trace = t.remove_trace
-local exec_lua = t.exec_lua
-local command = t.command
-local api = t.api
-local fn = t.fn
-local clear = t.clear
-local eval = t.eval
-local feed = t.feed
+local exec_lua = n.exec_lua
+local command = n.command
+local api = n.api
+local fn = n.fn
+local clear = n.clear
+local eval = n.eval
+local feed = n.feed
local NIL = vim.NIL
local eq = t.eq
diff --git a/test/functional/lua/mpack_spec.lua b/test/functional/lua/mpack_spec.lua
index a9400b34c8..efd69d4607 100644
--- a/test/functional/lua/mpack_spec.lua
+++ b/test/functional/lua/mpack_spec.lua
@@ -1,9 +1,10 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
describe('lua vim.mpack', function()
before_each(clear)
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua
index 7f325da307..849978f080 100644
--- a/test/functional/lua/overrides_spec.lua
+++ b/test/functional/lua/overrides_spec.lua
@@ -1,17 +1,18 @@
-- Test for Vim overrides of lua built-ins
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
local NIL = vim.NIL
-local feed = t.feed
-local clear = t.clear
-local fn = t.fn
-local api = t.api
-local command = t.command
+local feed = n.feed
+local clear = n.clear
+local fn = n.fn
+local api = n.api
+local command = n.command
local write_file = t.write_file
-local exec_capture = t.exec_capture
-local exec_lua = t.exec_lua
+local exec_capture = n.exec_capture
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
local is_os = t.is_os
diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua
index ad685dd8de..4adce42c3e 100644
--- a/test/functional/lua/runtime_spec.lua
+++ b/test/functional/lua/runtime_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local exec = t.exec
-local fn = t.fn
-local mkdir_p = t.mkdir_p
-local rmdir = t.rmdir
+local eval = n.eval
+local exec = n.exec
+local fn = n.fn
+local mkdir_p = n.mkdir_p
+local rmdir = n.rmdir
local write_file = t.write_file
describe('runtime:', function()
local plug_dir = 'Test_Plugin'
- local sep = t.get_pathsep()
+ local sep = n.get_pathsep()
local init = 'dummy_init.lua'
setup(function()
diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua
index 1a1a939d7c..c58fd689b7 100644
--- a/test/functional/lua/secure_spec.lua
+++ b/test/functional/lua/secure_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
-local clear = t.clear
-local command = t.command
-local pathsep = t.get_pathsep()
+local clear = n.clear
+local command = n.command
+local pathsep = n.get_pathsep()
local is_os = t.is_os
-local api = t.api
-local exec_lua = t.exec_lua
-local feed_command = t.feed_command
-local feed = t.feed
-local fn = t.fn
+local api = n.api
+local exec_lua = n.exec_lua
+local feed_command = n.feed_command
+local feed = n.feed
+local fn = n.fn
local stdpath = fn.stdpath
local pcall_err = t.pcall_err
local matches = t.matches
@@ -22,7 +23,7 @@ describe('vim.secure', function()
setup(function()
clear { env = { XDG_STATE_HOME = xstate } }
- t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
+ n.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
t.write_file(
'Xfile',
[[
@@ -33,7 +34,7 @@ describe('vim.secure', function()
teardown(function()
os.remove('Xfile')
- t.rmdir(xstate)
+ n.rmdir(xstate)
end)
it('works', function()
@@ -181,11 +182,11 @@ describe('vim.secure', function()
setup(function()
clear { env = { XDG_STATE_HOME = xstate } }
- t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
+ n.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
end)
teardown(function()
- t.rmdir(xstate)
+ n.rmdir(xstate)
end)
before_each(function()
diff --git a/test/functional/lua/snippet_spec.lua b/test/functional/lua/snippet_spec.lua
index 4dcba42e65..74f0869200 100644
--- a/test/functional/lua/snippet_spec.lua
+++ b/test/functional/lua/snippet_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local buf_lines = t.buf_lines
-local clear = t.clear
+local buf_lines = n.buf_lines
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
-local feed = t.feed
-local api = t.api
-local fn = t.fn
+local exec_lua = n.exec_lua
+local feed = n.feed
+local api = n.api
+local fn = n.fn
local matches = t.matches
local pcall_err = t.pcall_err
-local poke_eventloop = t.poke_eventloop
+local poke_eventloop = n.poke_eventloop
local retry = t.retry
describe('vim.snippet', function()
diff --git a/test/functional/lua/spell_spec.lua b/test/functional/lua/spell_spec.lua
index f2a81a2578..af7d08b390 100644
--- a/test/functional/lua/spell_spec.lua
+++ b/test/functional/lua/spell_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/lua/system_spec.lua b/test/functional/lua/system_spec.lua
index 6730eb98eb..e72a009d2e 100644
--- a/test/functional/lua/system_spec.lua
+++ b/test/functional/lua/system_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local function system_sync(cmd, opts)
diff --git a/test/functional/lua/text_spec.lua b/test/functional/lua/text_spec.lua
index d918ff7918..9e77953c8c 100644
--- a/test/functional/lua/text_spec.lua
+++ b/test/functional/lua/text_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
describe('vim.text', function()
diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua
index ce869291a2..780057b580 100644
--- a/test/functional/lua/thread_spec.lua
+++ b/test/functional/lua/thread_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local clear = t.clear
-local feed = t.feed
+
+local assert_alive = n.assert_alive
+local clear = n.clear
+local feed = n.feed
local eq = t.eq
-local exec_lua = t.exec_lua
-local next_msg = t.next_msg
+local exec_lua = n.exec_lua
+local next_msg = n.next_msg
local NIL = vim.NIL
local pcall_err = t.pcall_err
diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua
index d6572f9ae5..5fe51a2c35 100644
--- a/test/functional/lua/ui_event_spec.lua
+++ b/test/functional/lua/ui_event_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+
local eq = t.eq
-local exec_lua = t.exec_lua
-local clear = t.clear
-local feed = t.feed
-local fn = t.fn
+local exec_lua = n.exec_lua
+local clear = n.clear
+local feed = n.feed
+local fn = n.fn
local assert_log = t.assert_log
-local check_close = t.check_close
+local check_close = n.check_close
local testlog = 'Xtest_lua_ui_event_log'
@@ -112,7 +114,7 @@ describe('vim.ui_attach', function()
it('does not crash on exit', function()
fn.system({
- t.nvim_prog,
+ n.nvim_prog,
'-u',
'NONE',
'-i',
@@ -124,7 +126,7 @@ describe('vim.ui_attach', function()
'--cmd',
'quitall!',
})
- eq(0, t.eval('v:shell_error'))
+ eq(0, n.eval('v:shell_error'))
end)
it('can receive accurate message kinds even if they are history', function()
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua
index 2472725c56..d69e893c96 100644
--- a/test/functional/lua/ui_spec.lua
+++ b/test/functional/lua/ui_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
local ok = t.ok
-local exec_lua = t.exec_lua
-local clear = t.clear
-local feed = t.feed
-local eval = t.eval
+local exec_lua = n.exec_lua
+local clear = n.clear
+local feed = n.feed
+local eval = n.eval
local is_ci = t.is_ci
local is_os = t.is_os
-local poke_eventloop = t.poke_eventloop
+local poke_eventloop = n.poke_eventloop
describe('vim.ui', function()
before_each(function()
diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua
index 6cce83005c..553afb35d3 100644
--- a/test/functional/lua/uri_spec.lua
+++ b/test/functional/lua/uri_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local is_os = t.is_os
local skip = t.skip
diff --git a/test/functional/lua/version_spec.lua b/test/functional/lua/version_spec.lua
index ca275f6738..4ce8fb8dfe 100644
--- a/test/functional/lua/version_spec.lua
+++ b/test/functional/lua/version_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
local ok = t.ok
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local matches = t.matches
local pcall_err = t.pcall_err
-local fn = t.fn
+local fn = n.fn
local function v(ver)
return vim.version._version(ver)
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index bb8b43caf7..0f51831d52 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -1,32 +1,33 @@
-- Test suite for testing interactions with API bindings
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local nvim_prog = t.nvim_prog
-local fn = t.fn
-local api = t.api
-local command = t.command
+local nvim_prog = n.nvim_prog
+local fn = n.fn
+local api = n.api
+local command = n.command
local dedent = t.dedent
-local insert = t.insert
-local clear = t.clear
+local insert = n.insert
+local clear = n.clear
local eq = t.eq
local ok = t.ok
local pesc = vim.pesc
-local eval = t.eval
-local feed = t.feed
+local eval = n.eval
+local feed = n.feed
local pcall_err = t.pcall_err
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local matches = t.matches
-local exec = t.exec
+local exec = n.exec
local NIL = vim.NIL
local retry = t.retry
-local next_msg = t.next_msg
+local next_msg = n.next_msg
local remove_trace = t.remove_trace
-local mkdir_p = t.mkdir_p
-local rmdir = t.rmdir
+local mkdir_p = n.mkdir_p
+local rmdir = n.rmdir
local write_file = t.write_file
-local poke_eventloop = t.poke_eventloop
-local assert_alive = t.assert_alive
+local poke_eventloop = n.poke_eventloop
+local assert_alive = n.assert_alive
describe('lua stdlib', function()
before_each(clear)
@@ -1574,7 +1575,7 @@ describe('lua stdlib', function()
eq(NIL, exec_lua([[return vim.g.Unknown_script_func]]))
-- Check if autoload works properly
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = 'Xhome' .. pathsep .. 'Xconfig'
local xdata = 'Xhome' .. pathsep .. 'Xdata'
local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep)
@@ -4076,7 +4077,7 @@ describe('vim.keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('works with buffer-local mappings', function()
@@ -4100,7 +4101,7 @@ describe('vim.keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('does not mutate the opts parameter', function()
diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua
index deb8c8955b..bd8faadf5b 100644
--- a/test/functional/lua/watch_spec.lua
+++ b/test/functional/lua/watch_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
-local exec_lua = t.exec_lua
-local clear = t.clear
+local exec_lua = n.exec_lua
+local clear = n.clear
local is_ci = t.is_ci
local is_os = t.is_os
local skip = t.skip
@@ -24,7 +26,7 @@ describe('vim._watch', function()
if watchfunc == 'fswatch' then
skip(is_os('win'), 'not supported on windows')
skip(is_os('mac'), 'flaky test on mac')
- skip(not is_ci() and t.fn.executable('fswatch') == 0, 'fswatch not installed and not on CI')
+ skip(not is_ci() and n.fn.executable('fswatch') == 0, 'fswatch not installed and not on CI')
end
if watchfunc == 'watch' then
diff --git a/test/functional/lua/xdiff_spec.lua b/test/functional/lua/xdiff_spec.lua
index 0e5dd91fb8..d5589c1f13 100644
--- a/test/functional/lua/xdiff_spec.lua
+++ b/test/functional/lua/xdiff_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua
index 681f0f5cdd..c490ab67a9 100644
--- a/test/functional/options/autochdir_spec.lua
+++ b/test/functional/options/autochdir_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local fn = t.fn
-local command = t.command
+local fn = n.fn
+local command = n.command
local mkdir = t.mkdir
describe("'autochdir'", function()
@@ -38,7 +40,7 @@ describe("'autochdir'", function()
eq(dir_a, fn.getcwd())
fn.getwinvar(2, 'foo')
eq(dir_a, fn.getcwd())
- t.rmdir(dir_a)
- t.rmdir(dir_b)
+ n.rmdir(dir_a)
+ n.rmdir(dir_b)
end)
end)
diff --git a/test/functional/options/chars_spec.lua b/test/functional/options/chars_spec.lua
index 4f75c5800a..8e63e07e09 100644
--- a/test/functional/options/chars_spec.lua
+++ b/test/functional/options/chars_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, command = t.clear, t.command
+
+local clear, command = n.clear, n.command
local pcall_err = t.pcall_err
-local eval = t.eval
+local eval = n.eval
local eq = t.eq
-local insert = t.insert
-local feed = t.feed
-local api = t.api
+local insert = n.insert
+local feed = n.feed
+local api = n.api
describe("'fillchars'", function()
local screen
diff --git a/test/functional/options/cursorbind_spec.lua b/test/functional/options/cursorbind_spec.lua
index 3977d08317..19551b928f 100644
--- a/test/functional/options/cursorbind_spec.lua
+++ b/test/functional/options/cursorbind_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index d07ff3da0f..f61139d92d 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -1,26 +1,26 @@
-local t = require('test.functional.testutil')()
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local assert_log = t.assert_log
-local api = t.api
-local command = t.command
-local clear = t.clear
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local eval = t.eval
+local api = n.api
+local command = n.command
+local clear = n.clear
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local eval = n.eval
local eq = t.eq
local ok = t.ok
-local fn = t.fn
-local insert = t.insert
+local fn = n.fn
+local insert = n.insert
local neq = t.neq
local mkdir = t.mkdir
-local rmdir = t.rmdir
-local alter_slashes = t.alter_slashes
+local rmdir = n.rmdir
+local alter_slashes = n.alter_slashes
local tbl_contains = vim.tbl_contains
-local expect_exit = t.expect_exit
-local check_close = t.check_close
+local expect_exit = n.expect_exit
+local check_close = n.check_close
local is_os = t.is_os
local testlog = 'Xtest-defaults-log'
@@ -1248,7 +1248,7 @@ end)
describe('autocommands', function()
it('closes terminal with default shell on success', function()
clear()
- api.nvim_set_option_value('shell', t.testprg('shell-test'), {})
+ api.nvim_set_option_value('shell', n.testprg('shell-test'), {})
command('set shellcmdflag=EXIT shellredir= shellpipe= shellquote= shellxquote=')
-- Should not block other events
diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua
index 79b2e3dd0e..f76525699f 100644
--- a/test/functional/options/keymap_spec.lua
+++ b/test/functional/options/keymap_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear, feed, eq = t.clear, t.feed, t.eq
-local expect, command, eval = t.expect, t.command, t.eval
-local insert, call = t.insert, t.call
-local exec_capture, dedent = t.exec_capture, t.dedent
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed, eq = n.clear, n.feed, t.eq
+local expect, command, eval = n.expect, n.command, n.eval
+local insert, call = n.insert, n.call
+local exec_capture, dedent = n.exec_capture, t.dedent
-- First test it's implemented using the :lmap and :lnoremap commands, then
-- check those mappings behave as expected.
diff --git a/test/functional/options/modified_spec.lua b/test/functional/options/modified_spec.lua
index afd56eef98..956deb70ff 100644
--- a/test/functional/options/modified_spec.lua
+++ b/test/functional/options/modified_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local api = t.api
+local api = n.api
describe("'modified'", function()
before_each(function()
diff --git a/test/functional/options/mousescroll_spec.lua b/test/functional/options/mousescroll_spec.lua
index 281d6cbe04..2ccf934fd4 100644
--- a/test/functional/options/mousescroll_spec.lua
+++ b/test/functional/options/mousescroll_spec.lua
@@ -1,21 +1,23 @@
-local t = require('test.functional.testutil')()
-local command = t.command
-local clear = t.clear
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local command = n.command
+local clear = n.clear
+local eval = n.eval
local eq = t.eq
-local exc_exec = t.exc_exec
-local feed = t.feed
+local exc_exec = n.exc_exec
+local feed = n.feed
local scroll = function(direction)
- return t.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2)
+ return n.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2)
end
local screenrow = function()
- return t.call('screenrow')
+ return n.call('screenrow')
end
local screencol = function()
- return t.call('screencol')
+ return n.call('screencol')
end
describe("'mousescroll'", function()
diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua
index 7c6d0ea21e..3ac6f3f121 100644
--- a/test/functional/options/num_options_spec.lua
+++ b/test/functional/options/num_options_spec.lua
@@ -1,7 +1,9 @@
-- Tests for :setlocal and :setglobal
-local t = require('test.functional.testutil')()
-local clear, feed_command, eval, eq, api = t.clear, t.feed_command, t.eval, t.eq, t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed_command, eval, eq, api = n.clear, n.feed_command, n.eval, t.eq, n.api
local function should_fail(opt, value, errmsg)
feed_command('setglobal ' .. opt .. '=' .. value)
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 4fb69b79d8..dcbf9d15e0 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
+local eval = n.eval
+local feed = n.feed
describe("'shortmess'", function()
local screen
diff --git a/test/functional/options/tabstop_spec.lua b/test/functional/options/tabstop_spec.lua
index 7e9bd5e06c..4ddbb13a0e 100644
--- a/test/functional/options/tabstop_spec.lua
+++ b/test/functional/options/tabstop_spec.lua
@@ -1,8 +1,8 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local assert_alive = t.assert_alive
-local clear = t.clear
-local feed = t.feed
+local assert_alive = n.assert_alive
+local clear = n.clear
+local feed = n.feed
describe("'tabstop' option", function()
before_each(function()
diff --git a/test/functional/options/winfixbuf_spec.lua b/test/functional/options/winfixbuf_spec.lua
index 8a0df75782..124f194b5a 100644
--- a/test/functional/options/winfixbuf_spec.lua
+++ b/test/functional/options/winfixbuf_spec.lua
@@ -1,6 +1,7 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec_lua = t.exec_lua
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
describe("Nvim API calls with 'winfixbuf'", function()
before_each(function()
diff --git a/test/functional/plugin/ccomplete_spec.lua b/test/functional/plugin/ccomplete_spec.lua
index bb9b28d300..4c4c5e9444 100644
--- a/test/functional/plugin/ccomplete_spec.lua
+++ b/test/functional/plugin/ccomplete_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
+local eval = n.eval
+local feed = n.feed
local write_file = t.write_file
describe('ccomplete#Complete', function()
diff --git a/test/functional/plugin/cfilter_spec.lua b/test/functional/plugin/cfilter_spec.lua
index d421c5fc14..220404a934 100644
--- a/test/functional/plugin/cfilter_spec.lua
+++ b/test/functional/plugin/cfilter_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local fn = t.fn
+local fn = n.fn
describe('cfilter.lua', function()
before_each(function()
diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua
index d108f325e1..839a723405 100644
--- a/test/functional/plugin/editorconfig_spec.lua
+++ b/test/functional/plugin/editorconfig_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local pathsep = t.get_pathsep()
-local fn = t.fn
-local api = t.api
-local exec_lua = t.exec_lua
+local pathsep = n.get_pathsep()
+local fn = n.fn
+local api = n.api
+local exec_lua = n.exec_lua
local testdir = 'Xtest-editorconfig'
@@ -20,7 +22,7 @@ local function test_case(name, expected)
end
setup(function()
- t.mkdir_p(testdir)
+ n.mkdir_p(testdir)
t.write_file(
testdir .. pathsep .. '.editorconfig',
[[
@@ -96,7 +98,7 @@ setup(function()
end)
teardown(function()
- t.rmdir(testdir)
+ n.rmdir(testdir)
end)
describe('editorconfig', function()
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua
index 9c17e74e19..78cffd07fb 100644
--- a/test/functional/plugin/health_spec.lua
+++ b/test/functional/plugin/health_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local curbuf_contents = t.curbuf_contents
-local command = t.command
+local clear = n.clear
+local curbuf_contents = n.curbuf_contents
+local command = n.command
local eq, neq, matches = t.eq, t.neq, t.matches
-local getcompletion = t.fn.getcompletion
-local exec_lua = t.exec_lua
-local assert_alive = t.assert_alive
-local insert = t.insert
-local source = t.source
-local fn = t.fn
-local api = t.api
+local getcompletion = n.fn.getcompletion
+local insert = n.insert
+local exec_lua = n.exec_lua
+local source = n.source
+local assert_alive = n.assert_alive
+local fn = n.fn
+local api = n.api
describe(':checkhealth', function()
it('detects invalid $VIMRUNTIME', function()
@@ -67,7 +68,7 @@ describe('health.vim', function()
describe(':checkhealth', function()
it('functions report_*() render correctly', function()
command('checkhealth full_render')
- t.expect([[
+ n.expect([[
==============================================================================
test_plug.full_render: require("test_plug.full_render.health").check()
@@ -90,7 +91,7 @@ describe('health.vim', function()
it('concatenates multiple reports', function()
command('checkhealth success1 success2 test_plug')
- t.expect([[
+ n.expect([[
==============================================================================
test_plug: require("test_plug.health").check()
@@ -120,7 +121,7 @@ describe('health.vim', function()
it('lua plugins submodules', function()
command('checkhealth test_plug.submodule')
- t.expect([[
+ n.expect([[
==============================================================================
test_plug.submodule: require("test_plug.submodule.health").check()
@@ -135,7 +136,7 @@ describe('health.vim', function()
it('... including empty reports', function()
command('checkhealth test_plug.submodule_empty')
- t.expect([[
+ n.expect([[
==============================================================================
test_plug.submodule_empty: require("test_plug.submodule_empty.health").check()
@@ -176,7 +177,7 @@ describe('health.vim', function()
it('gracefully handles invalid healthcheck', function()
command('checkhealth non_existent_healthcheck')
-- luacheck: ignore 613
- t.expect([[
+ n.expect([[
==============================================================================
non_existent_healthcheck:
@@ -188,7 +189,7 @@ describe('health.vim', function()
it('does not use vim.health as a healtcheck', function()
-- vim.health is not a healthcheck
command('checkhealth vim')
- t.expect([[
+ n.expect([[
ERROR: No healthchecks found.]])
end)
end)
diff --git a/test/functional/plugin/lsp/codelens_spec.lua b/test/functional/plugin/lsp/codelens_spec.lua
index 20e850eeee..cd20e95dd1 100644
--- a/test/functional/plugin/lsp/codelens_spec.lua
+++ b/test/functional/plugin/lsp/codelens_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local eq = t.eq
describe('vim.lsp.codelens', function()
before_each(function()
- t.clear()
+ n.clear()
exec_lua('require("vim.lsp")')
end)
- after_each(t.clear)
+ after_each(n.clear)
it('on_codelens_stores_and_displays_lenses', function()
local fake_uri = 'file:///fake/uri'
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua
index 18f123a979..2798d57381 100644
--- a/test/functional/plugin/lsp/completion_spec.lua
+++ b/test/functional/plugin/lsp/completion_spec.lua
@@ -1,7 +1,9 @@
---@diagnostic disable: no-unknown
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
--- Convert completion results.
---
@@ -41,7 +43,7 @@ local function complete(line, candidates, lnum)
end
describe('vim.lsp._completion', function()
- before_each(t.clear)
+ before_each(n.clear)
-- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
it('prefers textEdit over label as word', function()
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index 27b0da1f3d..c5e14ffdc2 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local t_lsp = require('test.functional.plugin.lsp.testutil')
-local clear = t.clear
-local exec_lua = t.exec_lua
+local clear = n.clear
+local exec_lua = n.exec_lua
local eq = t.eq
local neq = t.neq
diff --git a/test/functional/plugin/lsp/handler_spec.lua b/test/functional/plugin/lsp/handler_spec.lua
index 0ce7479c49..013a5fb5e7 100644
--- a/test/functional/plugin/lsp/handler_spec.lua
+++ b/test/functional/plugin/lsp/handler_spec.lua
@@ -1,7 +1,8 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
local matches = t.matches
diff --git a/test/functional/plugin/lsp/incremental_sync_spec.lua b/test/functional/plugin/lsp/incremental_sync_spec.lua
index a44b861ca1..238b90b57d 100644
--- a/test/functional/plugin/lsp/incremental_sync_spec.lua
+++ b/test/functional/plugin/lsp/incremental_sync_spec.lua
@@ -1,11 +1,12 @@
-- Test suite for testing interactions with the incremental sync algorithms powering the LSP client
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local api = t.api
-local clear = t.clear
+local api = n.api
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
-local feed = t.feed
+local exec_lua = n.exec_lua
+local feed = n.feed
before_each(function()
clear()
diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua
index 24c93fcbe0..0aaf94d6da 100644
--- a/test/functional/plugin/lsp/inlay_hint_spec.lua
+++ b/test/functional/plugin/lsp/inlay_hint_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
-local t_lsp = require('test.functional.plugin.lsp.testutil')
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local t_lsp = require('test.functional.plugin.lsp.testutil')
local eq = t.eq
local dedent = t.dedent
-local exec_lua = t.exec_lua
-local insert = t.insert
-local api = t.api
+local exec_lua = n.exec_lua
+local insert = n.insert
+local api = n.api
local clear_notrace = t_lsp.clear_notrace
local create_server_definition = t_lsp.create_server_definition
diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua
index a9d8592eb0..013393095e 100644
--- a/test/functional/plugin/lsp/semantic_tokens_spec.lua
+++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
-local t_lsp = require('test.functional.plugin.lsp.testutil')
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local t_lsp = require('test.functional.plugin.lsp.testutil')
-local command = t.command
+local command = n.command
local dedent = t.dedent
local eq = t.eq
-local exec_lua = t.exec_lua
-local feed = t.feed
-local feed_command = t.feed_command
-local insert = t.insert
+local exec_lua = n.exec_lua
+local feed = n.feed
+local feed_command = n.feed_command
+local insert = n.insert
local matches = t.matches
-local api = t.api
+local api = n.api
local clear_notrace = t_lsp.clear_notrace
local create_server_definition = t_lsp.create_server_definition
diff --git a/test/functional/plugin/lsp/snippet_spec.lua b/test/functional/plugin/lsp/snippet_spec.lua
index 0f4304868b..e60c36cd23 100644
--- a/test/functional/plugin/lsp/snippet_spec.lua
+++ b/test/functional/plugin/lsp/snippet_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local snippet = require('vim.lsp._snippet_grammar')
local type = snippet.NodeType
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
describe('vim.lsp._snippet_grammar', function()
- before_each(t.clear)
- after_each(t.clear)
+ before_each(n.clear)
+ after_each(n.clear)
local parse = function(...)
local res = exec_lua('return require("vim.lsp._snippet_grammar").parse(...)', ...)
diff --git a/test/functional/plugin/lsp/testutil.lua b/test/functional/plugin/lsp/testutil.lua
index c51ccf3097..4d14752f2a 100644
--- a/test/functional/plugin/lsp/testutil.lua
+++ b/test/functional/plugin/lsp/testutil.lua
@@ -1,10 +1,10 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local exec_lua = t.exec_lua
-local run = t.run
-local stop = t.stop
-local api = t.api
+local clear = n.clear
+local exec_lua = n.exec_lua
+local run = n.run
+local stop = n.stop
+local api = n.api
local NIL = vim.NIL
local M = {}
diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua
index 8e57ace449..6c6dec0667 100644
--- a/test/functional/plugin/lsp/utils_spec.lua
+++ b/test/functional/plugin/lsp/utils_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
+local feed = n.feed
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
describe('vim.lsp.util', function()
- before_each(t.clear)
+ before_each(n.clear)
describe('stylize_markdown', function()
local stylize_markdown = function(content, opts)
@@ -142,7 +143,7 @@ describe('vim.lsp.util', function()
local screen
before_each(function()
- t.clear()
+ n.clear()
screen = Screen.new(80, 80)
screen:attach()
feed('79i<CR><Esc>') -- fill screen with empty lines
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index d471aadf9c..8d3e141944 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -1,26 +1,28 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local t_lsp = require('test.functional.plugin.lsp.testutil')
local assert_log = t.assert_log
-local buf_lines = t.buf_lines
-local clear = t.clear
-local command = t.command
+local buf_lines = n.buf_lines
+local clear = n.clear
+local command = n.command
local dedent = t.dedent
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
local matches = t.matches
local pcall_err = t.pcall_err
local pesc = vim.pesc
-local insert = t.insert
-local fn = t.fn
+local insert = n.insert
+local fn = n.fn
local retry = t.retry
-local stop = t.stop
+local stop = n.stop
local NIL = vim.NIL
local read_file = t.read_file
local write_file = t.write_file
local is_ci = t.is_ci
-local api = t.api
+local api = n.api
local is_os = t.is_os
local skip = t.skip
local mkdir = t.mkdir
@@ -1481,7 +1483,7 @@ describe('LSP', function()
end,
on_handler = function(err, result, ctx)
if ctx.method == 'start' then
- t.command('normal! 1Go')
+ n.command('normal! 1Go')
client.notify('finish')
end
eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler')
@@ -2368,7 +2370,7 @@ describe('LSP', function()
end)
describe('lsp.util.rename', function()
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
it('Can rename an existing file', function()
local old = tmpname()
@@ -2404,7 +2406,7 @@ describe('LSP', function()
os.remove(old_dir)
os.remove(new_dir)
- t.mkdir_p(old_dir)
+ n.mkdir_p(old_dir)
local file = 'file.txt'
write_file(old_dir .. pathsep .. file, 'Test content')
@@ -2440,7 +2442,7 @@ describe('LSP', function()
local new = tmpname()
os.remove(old)
os.remove(new)
- t.mkdir_p(old)
+ n.mkdir_p(old)
local result = exec_lua(
[[
diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua
index 19d279afbf..e9500bf920 100644
--- a/test/functional/plugin/man_spec.lua
+++ b/test/functional/plugin/man_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local command, feed = t.command, t.feed
-local clear = t.clear
-local exec_lua = t.exec_lua
-local fn = t.fn
-local nvim_prog = t.nvim_prog
+
+local command, feed = n.command, n.feed
+local clear = n.clear
+local exec_lua = n.exec_lua
+local fn = n.fn
+local nvim_prog = n.nvim_prog
local matches = t.matches
local write_file = t.write_file
local tmpname = t.tmpname
diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua
index ae343b9555..ae718ac1bd 100644
--- a/test/functional/plugin/matchparen_spec.lua
+++ b/test/functional/plugin/matchparen_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local api = t.api
-local feed = t.feed
+local clear = n.clear
+local command = n.command
+local api = n.api
+local feed = n.feed
local eq = t.eq
describe('matchparen', function()
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 9b70c12fc7..1d5d20ec02 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local api = n.api
local eq = t.eq
-local nvim_eval = t.eval
-local nvim_command = t.command
-local exc_exec = t.exc_exec
+local nvim_eval = n.eval
+local nvim_command = n.command
+local exc_exec = n.exc_exec
local ok = t.ok
local NIL = vim.NIL
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index 270eacc653..1c2bcbd497 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+local t_shada = require('test.functional.shada.testutil')
+
+local clear = n.clear
local eq, api, nvim_eval, nvim_command, exc_exec, fn, nvim_feed =
- t.eq, t.api, t.eval, t.command, t.exc_exec, t.fn, t.feed
+ t.eq, n.api, n.eval, n.command, n.exc_exec, n.fn, n.feed
local neq = t.neq
local read_file = t.read_file
-local t_shada = require('test.functional.shada.testutil')
local get_shada_rw = t_shada.get_shada_rw
local function reset(shada_file)
diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua
index f06d4d9c54..200a5f34b2 100644
--- a/test/functional/plugin/tohtml_spec.lua
+++ b/test/functional/plugin/tohtml_spec.lua
@@ -1,13 +1,14 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local exec = t.exec
-local exec_lua = t.exec_lua
+local clear = n.clear
+local exec = n.exec
+local exec_lua = n.exec_lua
local eq = t.eq
-local fn = t.fn
-local api = t.api
-local insert = t.insert
+local fn = n.fn
+local api = n.api
+local insert = n.insert
local function html_syntax_match()
local styles =
diff --git a/test/functional/plugin/tutor_spec.lua b/test/functional/plugin/tutor_spec.lua
index b8d5dc9399..9f381d45db 100644
--- a/test/functional/plugin/tutor_spec.lua
+++ b/test/functional/plugin/tutor_spec.lua
@@ -1,8 +1,10 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
local is_os = t.is_os
describe(':Tutor', function()
diff --git a/test/functional/plugin/vim_syntax_spec.lua b/test/functional/plugin/vim_syntax_spec.lua
index d31d6ad2f2..d99a69eab9 100644
--- a/test/functional/plugin/vim_syntax_spec.lua
+++ b/test/functional/plugin/vim_syntax_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local api = t.api
+
+local clear = n.clear
+local exec = n.exec
+local api = n.api
describe('Vimscript syntax highlighting', function()
local screen --- @type test.functional.ui.screen
before_each(function()
clear()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
exec([[
setfiletype vim
syntax on
diff --git a/test/functional/preload.lua b/test/functional/preload.lua
index 24e528bc5b..e524ab34aa 100644
--- a/test/functional/preload.lua
+++ b/test/functional/preload.lua
@@ -1,11 +1,10 @@
-- Modules loaded here will NOT be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation. See issue #62
-- for more information about this.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
require('test.functional.ui.screen')
-local is_os = t.is_os
-if is_os('win') then
+if t.is_os('win') then
local ffi = require('ffi')
ffi.cdef [[
typedef int errno_t;
diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua
index 3af52e8586..9e7df0ba6b 100644
--- a/test/functional/provider/clipboard_spec.lua
+++ b/test/functional/provider/clipboard_spec.lua
@@ -1,11 +1,13 @@
-- Test clipboard provider support
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local feed_command, expect, eq, eval, source = t.feed_command, t.expect, t.eq, t.eval, t.source
-local command = t.command
-local api = t.api
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local feed_command, expect, eq, eval, source = n.feed_command, n.expect, t.eq, n.eval, n.source
+local command = n.command
+local api = n.api
local function basic_register_test(noblock)
insert('some words')
diff --git a/test/functional/provider/define_spec.lua b/test/functional/provider/define_spec.lua
index f0d47cae16..3945486d98 100644
--- a/test/functional/provider/define_spec.lua
+++ b/test/functional/provider/define_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
-local eval, command = t.eval, t.command
-local eq, run, stop = t.eq, t.run, t.stop
-local clear = t.clear
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eval, command = n.eval, n.command
+local eq, run, stop = t.eq, n.run, n.stop
+local clear = n.clear
+local api = n.api
local function get_prefix(sync)
if sync then
@@ -28,7 +30,7 @@ local function runx(sync, handler, on_setup)
local function setup_cb(...)
on_setup(...)
-- need to stop on setup callback because there's two session:request
- -- calls in `request/testutil.lua`. The second call will always return
+ -- calls in `request/testnvim.lua`. The second call will always return
-- after pending notification/request callbacks are processed
stop()
end
@@ -324,7 +326,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init)
end)
it('with range', function()
- t.insert([[
+ n.insert([[
foo
bar
baz
diff --git a/test/functional/provider/nodejs_spec.lua b/test/functional/provider/nodejs_spec.lua
index 1cf90bc0eb..a67ad36f79 100644
--- a/test/functional/provider/nodejs_spec.lua
+++ b/test/functional/provider/nodejs_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
-local eq, clear = t.eq, t.clear
-local missing_provider = t.missing_provider
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, clear = t.eq, n.clear
+local missing_provider = n.missing_provider
+local command = n.command
local write_file = t.write_file
-local eval = t.eval
+local eval = n.eval
local retry = t.retry
do
diff --git a/test/functional/provider/perl_spec.lua b/test/functional/provider/perl_spec.lua
index b5828aa9fc..ea4aaa9ee9 100644
--- a/test/functional/provider/perl_spec.lua
+++ b/test/functional/provider/perl_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local eq, clear = t.eq, t.clear
-local missing_provider = t.missing_provider
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, clear = t.eq, n.clear
+local missing_provider = n.missing_provider
+local command = n.command
local write_file = t.write_file
-local eval = t.eval
+local eval = n.eval
local retry = t.retry
-local api = t.api
-local insert = t.insert
-local expect = t.expect
-local feed = t.feed
+local api = n.api
+local insert = n.insert
+local expect = n.expect
+local feed = n.feed
do
clear()
diff --git a/test/functional/provider/provider_spec.lua b/test/functional/provider/provider_spec.lua
index 19668f91f0..caed30ab0b 100644
--- a/test/functional/provider/provider_spec.lua
+++ b/test/functional/provider/provider_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, eval = t.clear, t.eval
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eval = n.clear, n.eval
+local command = n.command
local eq = t.eq
local pcall_err = t.pcall_err
diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua
index 0b1440f43f..71a067d3d2 100644
--- a/test/functional/provider/python3_spec.lua
+++ b/test/functional/provider/python3_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local assert_alive = t.assert_alive
-local eval, command, feed = t.eval, t.command, t.feed
-local eq, clear, insert = t.eq, t.clear, t.insert
-local expect, write_file = t.expect, t.write_file
-local feed_command = t.feed_command
-local source = t.source
-local missing_provider = t.missing_provider
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local eval, command, feed = n.eval, n.command, n.feed
+local eq, clear, insert = t.eq, n.clear, n.insert
+local expect, write_file = n.expect, t.write_file
+local feed_command = n.feed_command
+local source = n.source
+local missing_provider = n.missing_provider
local matches = t.matches
local pcall_err = t.pcall_err
-local fn = t.fn
+local fn = n.fn
local dedent = t.dedent
do
@@ -153,7 +155,7 @@ describe('python3 provider', function()
end)
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
source([=[
python3 << EOF
import vim
diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua
index bb8d5841c9..716ef296be 100644
--- a/test/functional/provider/ruby_spec.lua
+++ b/test/functional/provider/ruby_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local assert_alive = t.assert_alive
-local clear = t.clear
-local command = t.command
+local assert_alive = n.assert_alive
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local exc_exec = t.exc_exec
-local expect = t.expect
-local feed = t.feed
-local feed_command = t.feed_command
-local fn = t.fn
-local insert = t.insert
-local api = t.api
-local missing_provider = t.missing_provider
+local exc_exec = n.exc_exec
+local expect = n.expect
+local feed = n.feed
+local feed_command = n.feed_command
+local fn = n.fn
+local insert = n.insert
+local api = n.api
+local missing_provider = n.missing_provider
local matches = t.matches
local write_file = t.write_file
local pcall_err = t.pcall_err
@@ -103,7 +104,7 @@ end)
describe('ruby provider', function()
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
- t.add_builddir_to_rtp()
+ n.add_builddir_to_rtp()
command([=[autocmd BufDelete * ruby VIM::evaluate('expand("<afile>")')]=])
feed_command('help help')
assert_alive()
diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua
index c6f0f868f0..2dd3ad8a78 100644
--- a/test/functional/script/luacats_grammar_spec.lua
+++ b/test/functional/script/luacats_grammar_spec.lua
@@ -1,4 +1,5 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+
local eq = t.eq
local grammar = require('scripts/luacats_grammar')
diff --git a/test/functional/script/luacats_parser_spec.lua b/test/functional/script/luacats_parser_spec.lua
index e797a913ba..bc87b38eca 100644
--- a/test/functional/script/luacats_parser_spec.lua
+++ b/test/functional/script/luacats_parser_spec.lua
@@ -1,4 +1,5 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+
local eq = t.eq
local parser = require('scripts/luacats_parser')
diff --git a/test/functional/script/text_utils_spec.lua b/test/functional/script/text_utils_spec.lua
index 7c608c157c..176c2ef816 100644
--- a/test/functional/script/text_utils_spec.lua
+++ b/test/functional/script/text_utils_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local exec_lua = t.exec_lua
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local exec_lua = n.exec_lua
local eq = t.eq
local function md_to_vimdoc(text, start_indent, indent, text_width)
@@ -28,7 +30,7 @@ end
describe('md_to_vimdoc', function()
before_each(function()
- t.clear()
+ n.clear()
end)
test('can render para after fenced code', {
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua
index ed918e37f4..07b0bf4217 100644
--- a/test/functional/shada/buffers_spec.lua
+++ b/test/functional/shada/buffers_spec.lua
@@ -1,9 +1,11 @@
-- shada buffer list saving/reading support
-local t = require('test.functional.testutil')()
-local nvim_command, fn, eq, api = t.command, t.fn, t.eq, t.api
-local expect_exit = t.expect_exit
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, fn, eq, api = n.command, n.fn, t.eq, n.api
+local expect_exit = n.expect_exit
+
local reset, clear = t_shada.reset, t_shada.clear
describe('shada support code', function()
diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua
index b7f6bfb0b4..98d3884098 100644
--- a/test/functional/shada/compatibility_spec.lua
+++ b/test/functional/shada/compatibility_spec.lua
@@ -1,9 +1,10 @@
-- ShaDa compatibility support
-local t = require('test.functional.testutil')()
-local nvim_command, fn, eq = t.command, t.fn, t.eq
-local exc_exec = t.exc_exec
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, fn, eq = n.command, n.fn, t.eq
+local exc_exec = n.exc_exec
local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw
local read_shada_file = t_shada.read_shada_file
diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua
index 736a6956af..a9084da929 100644
--- a/test/functional/shada/errors_spec.lua
+++ b/test/functional/shada/errors_spec.lua
@@ -1,8 +1,9 @@
-- ShaDa errors handling support
-local t = require('test.functional.testutil')()
-local nvim_command, eq, exc_exec = t.command, t.eq, t.exc_exec
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, eq, exc_exec = n.command, t.eq, n.exc_exec
local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw
local wshada, sdrcmd, shada_fname, clean = get_shada_rw('Xtest-functional-shada-errors.shada')
diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua
index 521b7fb56f..1ad230f244 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -1,10 +1,12 @@
-- ShaDa history saving/reading support
-local t = require('test.functional.testutil')()
-local nvim_command, fn, api, nvim_feed, eq = t.command, t.fn, t.api, t.feed, t.eq
-local assert_alive = t.assert_alive
-local expect_exit = t.expect_exit
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, fn, api, nvim_feed, eq = n.command, n.fn, n.api, n.feed, t.eq
+local assert_alive = n.assert_alive
+local expect_exit = n.expect_exit
+
local reset, clear = t_shada.reset, t_shada.clear
describe('ShaDa support code', function()
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua
index e6eefd4aed..d680f0b83b 100644
--- a/test/functional/shada/marks_spec.lua
+++ b/test/functional/shada/marks_spec.lua
@@ -1,11 +1,13 @@
-- ShaDa marks saving/reading support
-local t = require('test.functional.testutil')()
-local api, nvim_command, fn, eq = t.api, t.command, t.fn, t.eq
-local feed = t.feed
-local exc_exec, exec_capture = t.exc_exec, t.exec_capture
-local expect_exit = t.expect_exit
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local api, nvim_command, fn, eq = n.api, n.command, n.fn, t.eq
+local feed = n.feed
+local exc_exec, exec_capture = n.exc_exec, n.exec_capture
+local expect_exit = n.expect_exit
+
local reset, clear = t_shada.reset, t_shada.clear
local nvim_current_line = function()
@@ -216,7 +218,7 @@ describe('ShaDa support code', function()
-- -c temporary sets lnum to zero to make `+/pat` work, so calling setpcmark()
-- during -c used to add item with zero lnum to jump list.
it('does not create incorrect file for non-existent buffers when writing from -c', function()
- local argv = t.new_argv {
+ local argv = n.new_argv {
args_rm = {
'-i',
'--embed', -- no --embed
@@ -235,7 +237,7 @@ describe('ShaDa support code', function()
end)
it('does not create incorrect file for non-existent buffers opened from -c', function()
- local argv = t.new_argv {
+ local argv = n.new_argv {
args_rm = {
'-i',
'--embed', -- no --embed
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua
index 57af4d5537..c98678ccbf 100644
--- a/test/functional/shada/merging_spec.lua
+++ b/test/functional/shada/merging_spec.lua
@@ -1,10 +1,12 @@
-- ShaDa merging data support
-local t = require('test.functional.testutil')()
-local nvim_command, fn, eq = t.command, t.fn, t.eq
-local exc_exec, exec_capture = t.exc_exec, t.exec_capture
-local api = t.api
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, fn, eq = n.command, n.fn, t.eq
+local exc_exec, exec_capture = n.exc_exec, n.exec_capture
+local api = n.api
+
local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw
local read_shada_file = t_shada.read_shada_file
diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua
index e6636e9ece..1e6249807e 100644
--- a/test/functional/shada/registers_spec.lua
+++ b/test/functional/shada/registers_spec.lua
@@ -1,10 +1,11 @@
-- ShaDa registers saving/reading support
-local t = require('test.functional.testutil')()
-local nvim_command, fn, eq = t.command, t.fn, t.eq
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local nvim_command, fn, eq = n.command, n.fn, t.eq
local reset, clear = t_shada.reset, t_shada.clear
-local expect_exit = t.expect_exit
+local expect_exit = n.expect_exit
local setreg = function(name, contents, typ)
if type(contents) == 'string' then
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua
index 8e677e2729..5debdc6c77 100644
--- a/test/functional/shada/shada_spec.lua
+++ b/test/functional/shada/shada_spec.lua
@@ -1,15 +1,16 @@
-- Other ShaDa tests
-local t = require('test.functional.testutil')()
-local api, nvim_command, fn, eq = t.api, t.command, t.fn, t.eq
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local t_shada = require('test.functional.shada.testutil')
+local uv = vim.uv
+local paths = t.paths
+
+local api, nvim_command, fn, eq = n.api, n.command, n.fn, t.eq
local write_file, spawn, set_session, nvim_prog, exc_exec =
- t.write_file, t.spawn, t.set_session, t.nvim_prog, t.exc_exec
+ t.write_file, n.spawn, n.set_session, n.nvim_prog, n.exc_exec
local is_os = t.is_os
local skip = t.skip
-local uv = vim.uv
-local paths = t.paths
-
-local t_shada = require('test.functional.shada.testutil')
local reset, clear, get_shada_rw = t_shada.reset, t_shada.clear, t_shada.get_shada_rw
local read_shada_file = t_shada.read_shada_file
diff --git a/test/functional/shada/testutil.lua b/test/functional/shada/testutil.lua
index 286a7a8e21..d9252af5f0 100644
--- a/test/functional/shada/testutil.lua
+++ b/test/functional/shada/testutil.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local api = n.api
local write_file = t.write_file
local concat_tables = t.concat_tables
@@ -24,7 +26,7 @@ local function reset(o)
elseif o.args then
args = concat_tables(args, o.args)
end
- t.clear {
+ n.clear {
args_rm = args_rm,
args = args,
}
@@ -32,7 +34,7 @@ local function reset(o)
end
local clear = function()
- t.expect_exit(t.command, 'qall!')
+ n.expect_exit(n.command, 'qall!')
os.remove(tmpname)
end
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua
index 19916ea466..2fea7278ef 100644
--- a/test/functional/shada/variables_spec.lua
+++ b/test/functional/shada/variables_spec.lua
@@ -1,9 +1,10 @@
-- ShaDa variables saving/reading support
-local t = require('test.functional.testutil')()
-local api, fn, nvim_command, eq, eval = t.api, t.fn, t.command, t.eq, t.eval
-local expect_exit = t.expect_exit
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local t_shada = require('test.functional.shada.testutil')
+
+local api, fn, nvim_command, eq, eval = n.api, n.fn, n.command, t.eq, n.eval
+local expect_exit = n.expect_exit
local reset, clear = t_shada.reset, t_shada.clear
describe('ShaDa support code', function()
diff --git a/test/functional/terminal/altscreen_spec.lua b/test/functional/terminal/altscreen_spec.lua
index 6a4887356e..12c8615799 100644
--- a/test/functional/terminal/altscreen_spec.lua
+++ b/test/functional/terminal/altscreen_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local tt = require('test.functional.terminal.testutil')
-local clear, eq, api = t.clear, t.eq, t.api
-local feed = t.feed
+local clear, eq, api = n.clear, t.eq, n.api
+local feed = n.feed
local feed_data = tt.feed_data
local enter_altscreen = tt.enter_altscreen
local exit_altscreen = tt.exit_altscreen
diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua
index f692335bfc..1f10dda551 100644
--- a/test/functional/terminal/api_spec.lua
+++ b/test/functional/terminal/api_spec.lua
@@ -1,4 +1,6 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local tt = require('test.functional.terminal.testutil')
local ok = t.ok
@@ -11,7 +13,7 @@ describe('api', function()
local socket_name = './Xtest_functional_api.sock'
before_each(function()
- t.clear()
+ n.clear()
os.remove(socket_name)
screen = tt.setup_child_nvim({
'-u',
@@ -21,7 +23,7 @@ describe('api', function()
'--cmd',
'colorscheme vim',
'--cmd',
- t.nvim_set .. ' notermguicolors',
+ n.nvim_set .. ' notermguicolors',
})
end)
after_each(function()
@@ -49,8 +51,8 @@ describe('api', function()
{3:-- TERMINAL --} |
]])
- local socket_session1 = t.connect(socket_name)
- local socket_session2 = t.connect(socket_name)
+ local socket_session1 = n.connect(socket_name)
+ local socket_session2 = n.connect(socket_name)
tt.feed_data('i[tui] insert-mode')
-- Wait for stdin to be processed.
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index 7cca620845..96abd9f543 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -1,23 +1,25 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local tt = require('test.functional.terminal.testutil')
-local assert_alive = t.assert_alive
-local feed, clear = t.feed, t.clear
-local poke_eventloop = t.poke_eventloop
-local nvim_prog = t.nvim_prog
-local eval, feed_command, source = t.eval, t.feed_command, t.source
+
+local assert_alive = n.assert_alive
+local feed, clear = n.feed, n.clear
+local poke_eventloop = n.poke_eventloop
+local nvim_prog = n.nvim_prog
+local eval, feed_command, source = n.eval, n.feed_command, n.source
local pcall_err = t.pcall_err
local eq, neq = t.eq, t.neq
-local api = t.api
+local api = n.api
local retry = t.retry
-local testprg = t.testprg
+local testprg = n.testprg
local write_file = t.write_file
-local command = t.command
-local exc_exec = t.exc_exec
+local command = n.command
+local exc_exec = n.exc_exec
local matches = t.matches
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local sleep = vim.uv.sleep
-local fn = t.fn
+local fn = n.fn
local is_os = t.is_os
local skip = t.skip
@@ -266,7 +268,7 @@ describe(':terminal buffer', function()
it('does not segfault when pasting empty register #13955', function()
feed('<c-\\><c-n>')
feed_command('put a') -- register a is empty
- t.assert_alive()
+ n.assert_alive()
end)
it([[can use temporary normal mode <c-\><c-o>]], function()
diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua
index c0b97fe414..774ff01291 100644
--- a/test/functional/terminal/channel_spec.lua
+++ b/test/functional/terminal/channel_spec.lua
@@ -1,17 +1,19 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local command = t.command
+local eval = n.eval
+local command = n.command
local pcall_err = t.pcall_err
-local feed = t.feed
-local poke_eventloop = t.poke_eventloop
+local feed = n.feed
+local poke_eventloop = n.poke_eventloop
local is_os = t.is_os
-local api = t.api
-local async_meths = t.async_meths
-local testprg = t.testprg
-local assert_alive = t.assert_alive
+local api = n.api
+local async_meths = n.async_meths
+local testprg = n.testprg
+local assert_alive = n.assert_alive
describe('terminal channel is closed and later released if', function()
local screen
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
index a6084d8bd6..51c6b12e62 100644
--- a/test/functional/terminal/cursor_spec.lua
+++ b/test/functional/terminal/cursor_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local tt = require('test.functional.terminal.testutil')
-local feed, clear = t.feed, t.clear
-local testprg, command = t.testprg, t.command
-local eq, eval = t.eq, t.eval
+
+local feed, clear = n.feed, n.clear
+local testprg, command = n.testprg, n.command
+local eq, eval = t.eq, n.eval
local matches = t.matches
-local poke_eventloop = t.poke_eventloop
+local poke_eventloop = n.poke_eventloop
local hide_cursor = tt.hide_cursor
local show_cursor = tt.show_cursor
local is_os = t.is_os
@@ -66,7 +68,7 @@ describe(':terminal cursor', function()
:set number |
]])
feed('i')
- t.poke_eventloop()
+ n.poke_eventloop()
screen:expect([[
{7: 1 }tty ready |
{7: 2 }rows: 6, cols: 46 |
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index 224d43a50c..24c5eb28e5 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local screen = require('test.functional.ui.screen')
-local testprg = t.testprg
-local command = t.command
-local fn = t.fn
-local api = t.api
-local clear = t.clear
+local testprg = n.testprg
+local command = n.command
+local fn = n.fn
+local api = n.api
+local clear = n.clear
local eq = t.eq
local matches = t.matches
local pesc = vim.pesc
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index 9a858c4764..1039572210 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local clear, poke_eventloop = t.clear, t.poke_eventloop
-local testprg, source, eq = t.testprg, t.source, t.eq
-local feed = t.feed
-local feed_command, eval = t.feed_command, t.eval
-local fn = t.fn
-local api = t.api
+
+local assert_alive = n.assert_alive
+local clear, poke_eventloop = n.clear, n.poke_eventloop
+local testprg, source, eq = n.testprg, n.source, t.eq
+local feed = n.feed
+local feed_command, eval = n.feed_command, n.eval
+local fn = n.fn
+local api = n.api
local retry = t.retry
local ok = t.ok
-local command = t.command
+local command = n.command
local skip = t.skip
local is_os = t.is_os
local is_ci = t.is_ci
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index 6fdfda82e6..4f3d010d02 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local tt = require('test.functional.terminal.testutil')
-local feed, clear = t.feed, t.clear
-local api = t.api
-local testprg, command = t.testprg, t.command
-local nvim_prog_abs = t.nvim_prog_abs
-local fn = t.fn
-local nvim_set = t.nvim_set
+
+local feed, clear = n.feed, n.clear
+local api = n.api
+local testprg, command = n.testprg, n.command
+local nvim_prog_abs = n.nvim_prog_abs
+local fn = n.fn
+local nvim_set = n.nvim_set
local is_os = t.is_os
local skip = t.skip
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index d730c0523f..ad98dfc6c3 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local tt = require('test.functional.terminal.testutil')
-local clear, eq, eval = t.clear, t.eq, t.eval
-local feed, api, command = t.feed, t.api, t.command
+local clear, eq, eval = n.clear, t.eq, n.eval
+local feed, api, command = n.feed, n.api, n.command
local feed_data = tt.feed_data
local is_os = t.is_os
local skip = t.skip
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 62277ce3ff..229a169996 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -1,17 +1,19 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
local tt = require('test.functional.terminal.testutil')
-local clear, eq = t.clear, t.eq
-local feed, testprg = t.feed, t.testprg
-local eval = t.eval
-local command = t.command
-local poke_eventloop = t.poke_eventloop
+
+local clear, eq = n.clear, t.eq
+local feed, testprg = n.feed, n.testprg
+local eval = n.eval
+local command = n.command
+local poke_eventloop = n.poke_eventloop
local retry = t.retry
-local api = t.api
+local api = n.api
local feed_data = tt.feed_data
local pcall_err = t.pcall_err
-local exec_lua = t.exec_lua
-local assert_alive = t.assert_alive
+local exec_lua = n.exec_lua
+local assert_alive = n.assert_alive
local skip = t.skip
local is_os = t.is_os
diff --git a/test/functional/terminal/testutil.lua b/test/functional/terminal/testutil.lua
index c5e5ed5e96..f3fc5d3f93 100644
--- a/test/functional/terminal/testutil.lua
+++ b/test/functional/terminal/testutil.lua
@@ -1,12 +1,13 @@
-- To test tui/input.c, this module spawns `nvim` inside :terminal and sends
-- bytes via jobsend(). Note: the functional/testutil.lua test-session methods
-- operate on the _host_ session, _not_ the child session.
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local testprg = t.testprg
-local exec_lua = t.exec_lua
-local api = t.api
-local nvim_prog = t.nvim_prog
+
+local testprg = n.testprg
+local exec_lua = n.exec_lua
+local api = n.api
+local nvim_prog = n.nvim_prog
local function feed_data(data)
if type(data) == 'table' then
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 7f74bf8176..f2f4f356be 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -4,31 +4,33 @@
-- "bracketed paste" terminal feature:
-- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode
-local t = require('test.functional.testutil')()
-local tt = require('test.functional.terminal.testutil')
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local tt = require('test.functional.terminal.testutil')
+
local eq = t.eq
local feed_data = tt.feed_data
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local dedent = t.dedent
-local exec = t.exec
-local exec_lua = t.exec_lua
-local testprg = t.testprg
+local exec = n.exec
+local exec_lua = n.exec_lua
+local testprg = n.testprg
local retry = t.retry
-local nvim_prog = t.nvim_prog
-local nvim_set = t.nvim_set
+local nvim_prog = n.nvim_prog
+local nvim_set = n.nvim_set
local ok = t.ok
local read_file = t.read_file
-local fn = t.fn
-local api = t.api
+local fn = n.fn
+local api = n.api
local is_ci = t.is_ci
local is_os = t.is_os
-local new_pipename = t.new_pipename
-local spawn_argv = t.spawn_argv
-local set_session = t.set_session
+local new_pipename = n.new_pipename
+local spawn_argv = n.spawn_argv
+local set_session = n.set_session
local write_file = t.write_file
-local eval = t.eval
+local eval = n.eval
local assert_log = t.assert_log
local testlog = 'Xtest-tui-log'
@@ -64,7 +66,7 @@ describe('TUI', function()
|
{3:-- TERMINAL --} |
]])
- child_session = t.connect(child_server)
+ child_session = n.connect(child_server)
child_exec_lua = tt.make_lua_executor(child_session)
end)
@@ -2248,7 +2250,7 @@ describe('TUI FocusGained/FocusLost', function()
|
{3:-- TERMINAL --} |
]])
- child_session = t.connect(child_server)
+ child_session = n.connect(child_server)
child_session:request(
'nvim_exec2',
[[
@@ -2891,7 +2893,7 @@ describe('TUI', function()
screen:expect({ any = '%[No Name%]' })
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
retry(nil, 1000, function()
eq({
Tc = true,
@@ -2937,7 +2939,7 @@ describe('TUI', function()
screen:expect({ any = '%[No Name%]' })
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
retry(nil, 1000, function()
eq('Ms', eval("get(g:, 'xtgettcap', '')"))
eq({ true, 'OSC 52' }, { child_session:request('nvim_eval', 'g:clipboard.name') })
@@ -2965,7 +2967,7 @@ describe('TUI bg color', function()
'set noswapfile',
})
screen:expect({ any = '%[No Name%]' })
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
retry(nil, nil, function()
eq({ true, 'dark' }, { child_session:request('nvim_eval', '&background') })
end)
@@ -2988,7 +2990,7 @@ describe('TUI bg color', function()
'set noswapfile',
})
screen:expect({ any = '%[No Name%]' })
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
retry(nil, nil, function()
eq({ true, 'light' }, { child_session:request('nvim_eval', '&background') })
end)
diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua
index 1003ced189..f85e26a66d 100644
--- a/test/functional/terminal/window_spec.lua
+++ b/test/functional/terminal/window_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local tt = require('test.functional.terminal.testutil')
local feed_data = tt.feed_data
-local feed, clear = t.feed, t.clear
-local poke_eventloop = t.poke_eventloop
-local command = t.command
+local feed, clear = n.feed, n.clear
+local poke_eventloop = n.poke_eventloop
+local command = n.command
local retry = t.retry
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
local skip = t.skip
local is_os = t.is_os
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
index 8ccdaf21cb..04d2e0bca7 100644
--- a/test/functional/terminal/window_split_tab_spec.lua
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local tt = require('test.functional.terminal.testutil')
-local assert_alive = t.assert_alive
-local clear = t.clear
-local feed = t.feed
-local feed_command = t.feed_command
-local command = t.command
+local assert_alive = n.assert_alive
+local clear = n.clear
+local feed = n.feed
+local feed_command = n.feed_command
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local api = t.api
+local eval = n.eval
+local api = n.api
local sleep = vim.uv.sleep
local retry = t.retry
local is_os = t.is_os
diff --git a/test/functional/testutil.lua b/test/functional/testnvim.lua
index 65756deca2..0533e8ad0a 100644
--- a/test/functional/testutil.lua
+++ b/test/functional/testnvim.lua
@@ -1,25 +1,25 @@
local uv = vim.uv
-local t_global = require('test.testutil')
+local t = require('test.testutil')
local Session = require('test.client.session')
local uv_stream = require('test.client.uv_stream')
local SocketStream = uv_stream.SocketStream
local ChildProcessStream = uv_stream.ChildProcessStream
-local check_cores = t_global.check_cores
-local check_logs = t_global.check_logs
-local dedent = t_global.dedent
-local eq = t_global.eq
-local is_os = t_global.is_os
-local ok = t_global.ok
+local check_cores = t.check_cores
+local check_logs = t.check_logs
+local dedent = t.dedent
+local eq = t.eq
+local is_os = t.is_os
+local ok = t.ok
local sleep = uv.sleep
-local fail = t_global.fail
---- @class test.functional.testutil: test.testutil
-local M = vim.deepcopy(t_global)
+--- This module uses functions from the context of the test session, i.e. in the context of the
+--- nvim being tests.
+local M = {}
local runtime_set = 'set runtimepath^=./build/lib/nvim/'
-M.nvim_prog = (os.getenv('NVIM_PRG') or t_global.paths.test_build_dir .. '/bin/nvim')
+M.nvim_prog = (os.getenv('NVIM_PRG') or t.paths.test_build_dir .. '/bin/nvim')
-- Default settings for the test session.
M.nvim_set = (
'set shortmess+=IS background=light termguicolors noswapfile noautoindent startofline'
@@ -321,11 +321,11 @@ end
function M.expect_exit(fn_or_timeout, ...)
local eof_err_msg = 'EOF was received from Nvim. Likely the Nvim process crashed.'
if type(fn_or_timeout) == 'function' then
- eq(eof_err_msg, M.pcall_err(fn_or_timeout, ...))
+ eq(eof_err_msg, t.pcall_err(fn_or_timeout, ...))
else
eq(
eof_err_msg,
- M.pcall_err(function(timeout, fn, ...)
+ t.pcall_err(function(timeout, fn, ...)
fn(...)
assert(session)
while session:next_message(timeout) do
@@ -735,27 +735,6 @@ function M.expect_any(contents)
return ok(nil ~= string.find(M.curbuf_contents(), contents, 1, true))
end
---- @param expected any[]
---- @param received any[]
---- @param kind string
---- @return any
-function M.expect_events(expected, received, kind)
- if not pcall(eq, expected, received) then
- local msg = 'unexpected ' .. kind .. ' received.\n\n'
-
- msg = msg .. 'received events:\n'
- for _, e in ipairs(received) do
- msg = msg .. ' ' .. vim.inspect(e) .. ';\n'
- end
- msg = msg .. '\nexpected events:\n'
- for _, e in ipairs(expected) do
- msg = msg .. ' ' .. vim.inspect(e) .. ';\n'
- end
- fail(msg)
- end
- return received
-end
-
-- Checks that the Nvim session did not terminate.
function M.assert_alive()
assert(2 == M.eval('1+1'), 'crash? request failed')
@@ -790,7 +769,7 @@ local function do_rmdir(path)
for file in vim.fs.dir(path) do
if file ~= '.' and file ~= '..' then
local abspath = path .. '/' .. file
- if t_global.isdir(abspath) then
+ if t.isdir(abspath) then
do_rmdir(abspath) -- recurse
else
local ret, err = os.remove(abspath)
@@ -846,35 +825,6 @@ function M.exc_exec(cmd)
return ret
end
---- @param cond boolean
---- @param reason? string
---- @return boolean
-function M.skip(cond, reason)
- if cond then
- --- @type fun(reason: string)
- local pending = getfenv(2).pending
- pending(reason or 'FIXME')
- return true
- end
- return false
-end
-
--- Calls pending() and returns `true` if the system is too slow to
--- run fragile or expensive tests. Else returns `false`.
-function M.skip_fragile(pending_fn, cond)
- if pending_fn == nil or type(pending_fn) ~= type(function() end) then
- error('invalid pending_fn')
- end
- if cond then
- pending_fn('skipped (test is fragile on this system)', function() end)
- return true
- elseif os.getenv('TEST_SKIP_FRAGILE') then
- pending_fn('skipped (TEST_SKIP_FRAGILE)', function() end)
- return true
- end
- return false
-end
-
function M.exec(code)
M.api.nvim_exec2(code, {})
end
@@ -906,7 +856,7 @@ end
---
--- @param name (string) Name of the test program.
function M.testprg(name)
- local ext = M.is_os('win') and '.exe' or ''
+ local ext = is_os('win') and '.exe' or ''
return ('%s/%s%s'):format(M.nvim_dir, name, ext)
end
@@ -965,7 +915,7 @@ function M.alter_slashes(obj)
end
local load_factor = 1
-if t_global.is_ci() then
+if t.is_ci() then
-- Compute load factor only once (but outside of any tests).
M.clear()
M.request('nvim_command', 'source test/old/testdir/load.vim')
@@ -1000,7 +950,7 @@ end
function M.add_builddir_to_rtp()
-- Add runtime from build dir for doc/tags (used with :help).
- M.command(string.format([[set rtp+=%s/runtime]], M.paths.test_build_dir))
+ M.command(string.format([[set rtp+=%s/runtime]], t.paths.test_build_dir))
end
--- Kill (reap) a process by PID.
diff --git a/test/functional/treesitter/fold_spec.lua b/test/functional/treesitter/fold_spec.lua
index 06f97dc9bb..a7f278aa01 100644
--- a/test/functional/treesitter/fold_spec.lua
+++ b/test/functional/treesitter/fold_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local eq = t.eq
-local insert = t.insert
-local exec_lua = t.exec_lua
-local command = t.command
-local feed = t.feed
-local poke_eventloop = t.poke_eventloop
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local clear = n.clear
+local eq = t.eq
+local insert = n.insert
+local exec_lua = n.exec_lua
+local command = n.command
+local feed = n.feed
+local poke_eventloop = n.poke_eventloop
+
before_each(clear)
describe('treesitter foldexpr', function()
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua
index ecfe32db91..1d7ee00818 100644
--- a/test/functional/treesitter/highlight_spec.lua
+++ b/test/functional/treesitter/highlight_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local insert = t.insert
-local exec_lua = t.exec_lua
-local feed = t.feed
-local command = t.command
-local api = t.api
+local clear = n.clear
+local insert = n.insert
+local exec_lua = n.exec_lua
+local feed = n.feed
+local command = n.command
+local api = n.api
local eq = t.eq
before_each(clear)
@@ -872,7 +873,7 @@ describe('treesitter highlighting (help)', function()
]],
}
- t.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' })
+ n.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' })
screen:expect {
grid = [[
@@ -885,7 +886,7 @@ describe('treesitter highlighting (help)', function()
]],
}
- t.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' })
+ n.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' })
screen:expect {
grid = [[
diff --git a/test/functional/treesitter/inspect_tree_spec.lua b/test/functional/treesitter/inspect_tree_spec.lua
index a2679b2059..f5acfe7c4a 100644
--- a/test/functional/treesitter/inspect_tree_spec.lua
+++ b/test/functional/treesitter/inspect_tree_spec.lua
@@ -1,17 +1,19 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local insert = t.insert
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local insert = n.insert
local dedent = t.dedent
local eq = t.eq
-local exec_lua = t.exec_lua
-local feed = t.feed
+local exec_lua = n.exec_lua
+local feed = n.feed
describe('vim.treesitter.inspect_tree', function()
before_each(clear)
local expect_tree = function(x)
local expected = vim.split(vim.trim(dedent(x)), '\n')
- local actual = t.buf_lines(0) ---@type string[]
+ local actual = n.buf_lines(0) ---@type string[]
eq(expected, actual)
end
diff --git a/test/functional/treesitter/language_spec.lua b/test/functional/treesitter/language_spec.lua
index 365e2a697a..40c974beee 100644
--- a/test/functional/treesitter/language_spec.lua
+++ b/test/functional/treesitter/language_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local command = t.command
-local exec_lua = t.exec_lua
+local command = n.command
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
local matches = t.matches
-local insert = t.insert
+local insert = n.insert
before_each(clear)
diff --git a/test/functional/treesitter/node_spec.lua b/test/functional/treesitter/node_spec.lua
index aaa7cee9d6..8adec82774 100644
--- a/test/functional/treesitter/node_spec.lua
+++ b/test/functional/treesitter/node_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
-local insert = t.insert
-local assert_alive = t.assert_alive
+local exec_lua = n.exec_lua
+local insert = n.insert
+local assert_alive = n.assert_alive
before_each(clear)
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 8b08f83ee6..1166166530 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -1,12 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local dedent = t.dedent
local eq = t.eq
-local insert = t.insert
-local exec_lua = t.exec_lua
+local insert = n.insert
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
-local feed = t.feed
+local feed = n.feed
describe('treesitter parser API', function()
before_each(function()
@@ -381,7 +382,7 @@ int x = INT_MAX;
{ 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- t.feed('ggo<esc>')
+ n.feed('ggo<esc>')
eq(5, exec_lua('return #parser:children().c:trees()'))
eq({
{ 0, 0, 8, 0 }, -- root tree
@@ -418,7 +419,7 @@ int x = INT_MAX;
-- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- t.feed('ggo<esc>')
+ n.feed('ggo<esc>')
eq('table', exec_lua('return type(parser:children().c)'))
eq(2, exec_lua('return #parser:children().c:trees()'))
eq({
@@ -430,7 +431,7 @@ int x = INT_MAX;
-- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- t.feed('7ggI//<esc>')
+ n.feed('7ggI//<esc>')
exec_lua([[parser:parse({6, 7})]])
eq('table', exec_lua('return type(parser:children().c)'))
eq(2, exec_lua('return #parser:children().c:trees()'))
@@ -468,7 +469,7 @@ int x = INT_MAX;
{ 2, 29, 2, 66 }, -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())
- t.feed('ggo<esc>')
+ n.feed('ggo<esc>')
eq(5, exec_lua('return #parser:children().c:trees()'))
eq({
{ 0, 0, 8, 0 }, -- root tree
@@ -657,7 +658,7 @@ int x = INT_MAX;
{ 'declaration', 1, 2, 1, 12 },
}, run_query())
- t.command 'normal ggO'
+ n.command 'normal ggO'
insert('int a;')
eq({
diff --git a/test/functional/treesitter/query_spec.lua b/test/functional/treesitter/query_spec.lua
index 34f3734f2b..3dad61d79e 100644
--- a/test/functional/treesitter/query_spec.lua
+++ b/test/functional/treesitter/query_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local dedent = t.dedent
local eq = t.eq
-local insert = t.insert
-local exec_lua = t.exec_lua
+local insert = n.insert
+local exec_lua = n.exec_lua
local pcall_err = t.pcall_err
local is_os = t.is_os
-local api = t.api
-local fn = t.fn
+local api = n.api
+local fn = n.fn
describe('treesitter query API', function()
before_each(function()
@@ -67,7 +68,7 @@ void ui_refresh(void)
it('supports caching queries', function()
local long_query = test_query:rep(100)
---@return number
- local function q(n)
+ local function q(_n)
return exec_lua(
[[
local query, n = ...
@@ -79,7 +80,7 @@ void ui_refresh(void)
return after - before
]],
long_query,
- n
+ _n
)
end
diff --git a/test/functional/treesitter/utils_spec.lua b/test/functional/treesitter/utils_spec.lua
index 1df8a098f9..bca0aca0cb 100644
--- a/test/functional/treesitter/utils_spec.lua
+++ b/test/functional/treesitter/utils_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local insert = t.insert
+local clear = n.clear
+local insert = n.insert
local eq = t.eq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
before_each(clear)
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 7ea7319cf8..5590db5bc4 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, neq = t.command, t.neq
-local api = t.api
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, neq = n.command, t.neq
+local api = n.api
local eq = t.eq
local pcall_err = t.pcall_err
local set_virtual_text = api.nvim_buf_set_virtual_text
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index ee8c713603..1c6f19245a 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
-local feed = t.feed
-local clear = t.clear
-local api = t.api
-local fn = t.fn
-local source = t.source
-local exec_capture = t.exec_capture
+local feed = n.feed
+local clear = n.clear
+local api = n.api
+local fn = n.fn
+local source = n.source
+local exec_capture = n.exec_capture
local dedent = t.dedent
-local command = t.command
+local command = n.command
local screen
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 645f3851b2..b3ec5f7535 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed = t.clear, t.feed
-local source = t.source
-local command = t.command
-local assert_alive = t.assert_alive
-local poke_eventloop = t.poke_eventloop
-local exec = t.exec
-local eval = t.eval
+
+local clear, feed = n.clear, n.feed
+local source = n.source
+local command = n.command
+local assert_alive = n.assert_alive
+local poke_eventloop = n.poke_eventloop
+local exec = n.exec
+local eval = n.eval
local eq = t.eq
local is_os = t.is_os
-local api = t.api
+local api = n.api
local function new_screen(opt)
local screen = Screen.new(25, 5)
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index 9bfc8c6fb9..8bfceb8cce 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, api = t.clear, t.api
+
+local clear, api = n.clear, n.api
local eq = t.eq
-local command = t.command
+local command = n.command
describe('ui/cursor', function()
local screen
@@ -213,8 +215,8 @@ describe('ui/cursor', function()
}
-- Change the cursor style.
- t.command('hi Cursor guibg=DarkGray')
- t.command(
+ n.command('hi Cursor guibg=DarkGray')
+ n.command(
'set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr-o:hor20'
.. ',a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor'
.. ',sm:block-blinkwait175-blinkoff150-blinkon175'
@@ -260,8 +262,8 @@ describe('ui/cursor', function()
end)
-- Change hl groups only, should update the styles
- t.command('hi Cursor guibg=Red')
- t.command('hi lCursor guibg=Green')
+ n.command('hi Cursor guibg=Red')
+ n.command('hi lCursor guibg=Green')
-- Update the expected values.
for _, m in ipairs(expected_mode_info) do
@@ -280,7 +282,7 @@ describe('ui/cursor', function()
end)
-- update the highlight again to hide cursor
- t.command('hi Cursor blend=100')
+ n.command('hi Cursor blend=100')
for _, m in ipairs(expected_mode_info) do
if m.hl_id then
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 4e7245c166..ac879c33fc 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed = t.feed
-local insert = t.insert
-local exec_lua = t.exec_lua
-local exec = t.exec
+local clear = n.clear
+local feed = n.feed
+local insert = n.insert
+local exec_lua = n.exec_lua
+local exec = n.exec
local expect_events = t.expect_events
-local api = t.api
-local fn = t.fn
-local command = t.command
+local api = n.api
+local fn = n.fn
+local command = n.command
local eq = t.eq
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local pcall_err = t.pcall_err
describe('decorations providers', function()
@@ -723,7 +724,7 @@ describe('decorations providers', function()
end
]]
- t.assert_alive()
+ n.assert_alive()
end)
it('supports subpriorities (order of definitions in a query file #27131)', function()
@@ -2438,7 +2439,7 @@ describe('extmark decorations', function()
|
]]}
- t.assert_alive()
+ n.assert_alive()
end)
it('priority ordering of overlay or win_col virtual text at same position', function()
@@ -5153,8 +5154,8 @@ l5
insert(example_test3)
feed 'gg'
- t.command('sign define Oldsign text=x')
- t.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]])
+ n.command('sign define Oldsign text=x')
+ n.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]])
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'})
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'})
@@ -5177,8 +5178,8 @@ l5
insert(example_test3)
feed 'gg'
- t.command('sign define Oldsign text=x')
- t.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]])
+ n.command('sign define Oldsign text=x')
+ n.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]])
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'})
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'})
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index 73fd7513c8..e79621f364 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
-local clear = t.clear
-local command = t.command
-local insert = t.insert
+local feed = n.feed
+local clear = n.clear
+local command = n.command
+local insert = n.insert
local write_file = t.write_file
local dedent = t.dedent
-local exec = t.exec
+local exec = n.exec
local eq = t.eq
-local api = t.api
+local api = n.api
before_each(clear)
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index 934f00b288..e1abd43e20 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -1,20 +1,20 @@
-local uv = vim.uv
-
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local uv = vim.uv
-local api = t.api
-local feed = t.feed
+local api = n.api
+local feed = n.feed
local eq = t.eq
local neq = t.neq
-local clear = t.clear
+local clear = n.clear
local ok = t.ok
-local fn = t.fn
-local nvim_prog = t.nvim_prog
+local fn = n.fn
+local nvim_prog = n.nvim_prog
local retry = t.retry
local write_file = t.write_file
local assert_log = t.assert_log
-local check_close = t.check_close
+local check_close = n.check_close
local is_os = t.is_os
local testlog = 'Xtest-embed-log'
@@ -258,7 +258,7 @@ describe('--embed UI', function()
}
-- Change global cwd
- t.command(string.format('cd %s/src/nvim', t.paths.test_source_path))
+ n.command(string.format('cd %s/src/nvim', t.paths.test_source_path))
screen:expect {
condition = function()
@@ -267,8 +267,8 @@ describe('--embed UI', function()
}
-- Split the window and change the cwd in the split
- t.command('new')
- t.command(string.format('lcd %s/test', t.paths.test_source_path))
+ n.command('new')
+ n.command(string.format('lcd %s/test', t.paths.test_source_path))
screen:expect {
condition = function()
@@ -277,7 +277,7 @@ describe('--embed UI', function()
}
-- Move to the original window
- t.command('wincmd p')
+ n.command('wincmd p')
screen:expect {
condition = function()
@@ -286,7 +286,7 @@ describe('--embed UI', function()
}
-- Change global cwd again
- t.command(string.format('cd %s', t.paths.test_source_path))
+ n.command(string.format('cd %s', t.paths.test_source_path))
screen:expect {
condition = function()
@@ -300,7 +300,7 @@ describe('--embed --listen UI', function()
it('waits for connection on listening address', function()
t.skip(t.is_os('win'))
clear()
- local child_server = assert(t.new_pipename())
+ local child_server = assert(n.new_pipename())
fn.jobstart({
nvim_prog,
'--embed',
@@ -314,7 +314,7 @@ describe('--embed --listen UI', function()
neq(nil, uv.fs_stat(child_server))
end)
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
local info_ok, api_info = child_session:request('nvim_get_api_info')
ok(info_ok)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 99cb2e56f4..b7fb9dbd32 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -1,24 +1,26 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local os = require('os')
-local clear, feed = t.clear, t.feed
-local assert_alive = t.assert_alive
-local command, feed_command = t.command, t.feed_command
-local eval = t.eval
+
+local clear, feed = n.clear, n.feed
+local assert_alive = n.assert_alive
+local command, feed_command = n.command, n.feed_command
+local eval = n.eval
local eq = t.eq
local neq = t.neq
-local expect = t.expect
-local exec = t.exec
-local exec_lua = t.exec_lua
-local insert = t.insert
-local api = t.api
-local fn = t.fn
-local run = t.run
+local expect = n.expect
+local exec = n.exec
+local exec_lua = n.exec_lua
+local insert = n.insert
+local api = n.api
+local fn = n.fn
+local run = n.run
local pcall_err = t.pcall_err
local tbl_contains = vim.tbl_contains
-local curbuf = t.api.nvim_get_current_buf
-local curwin = t.api.nvim_get_current_win
-local curtab = t.api.nvim_get_current_tabpage
+local curbuf = n.api.nvim_get_current_buf
+local curwin = n.api.nvim_get_current_win
+local curtab = n.api.nvim_get_current_tabpage
local NIL = vim.NIL
describe('float window', function()
@@ -4120,7 +4122,7 @@ describe('float window', function()
if multigrid then
pending("supports second UI without multigrid", function()
- local session2 = t.connect(eval('v:servername'))
+ local session2 = n.connect(eval('v:servername'))
print(session2:request("nvim_eval", "2+2"))
local screen2 = Screen.new(40,7)
screen2:attach(nil, session2)
@@ -8018,7 +8020,7 @@ describe('float window', function()
end)
it("correctly redraws when overlaid windows are resized #13991", function()
- t.source([[
+ n.source([[
let popup_config = {"relative" : "editor",
\ "width" : 7,
\ "height" : 3,
@@ -8082,7 +8084,7 @@ describe('float window', function()
]])
end
- t.source([[
+ n.source([[
let new_popup_config = {"width" : 1, "height" : 3}
let new_border_config = {"width" : 3, "height" : 5}
@@ -8097,7 +8099,7 @@ describe('float window', function()
nnoremap zz <cmd>call Resize()<cr>
]])
- t.feed("zz")
+ n.feed("zz")
if multigrid then
screen:expect{grid=[[
## grid 1
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 7e1cc546ae..2712e5ff48 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, eq = t.clear, t.feed, t.eq
-local command = t.command
-local feed_command = t.feed_command
-local insert = t.insert
-local fn = t.fn
-local api = t.api
-local exec = t.exec
-local assert_alive = t.assert_alive
+
+local clear, feed, eq = n.clear, n.feed, t.eq
+local command = n.command
+local feed_command = n.feed_command
+local insert = n.insert
+local fn = n.fn
+local api = n.api
+local exec = n.exec
+local assert_alive = n.assert_alive
local content1 = [[
This is a
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index bb17b1ec6c..b7b46ddfae 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local os = require('os')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command, exec = t.command, t.exec
-local eval = t.eval
-local feed_command, eq = t.feed_command, t.eq
-local fn = t.fn
-local api = t.api
-local exec_lua = t.exec_lua
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command, exec = n.command, n.exec
+local eval = n.eval
+local feed_command, eq = n.feed_command, t.eq
+local fn = n.fn
+local api = n.api
+local exec_lua = n.exec_lua
describe('colorscheme compatibility', function()
before_each(function()
@@ -2196,7 +2198,7 @@ describe("'winhighlight' highlight", function()
]],
}
- t.assert_alive()
+ n.assert_alive()
end)
it('can redraw statusline on cursor movement', function()
diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua
index 03802fc1b2..8d14c9f73d 100644
--- a/test/functional/ui/hlstate_spec.lua
+++ b/test/functional/ui/hlstate_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-
-local clear, insert = t.clear, t.insert
-local command = t.command
-local api = t.api
-local testprg = t.testprg
local tt = require('test.functional.terminal.testutil')
+
+local clear, insert = n.clear, n.insert
+local command = n.command
+local api = n.api
+local testprg = n.testprg
local skip = t.skip
local is_os = t.is_os
@@ -381,7 +382,7 @@ describe('ext_hlstate detailed highlights', function()
},
}
- t.feed('3ggV2jd')
+ n.feed('3ggV2jd')
--screen:redraw_debug()
screen:expect {
grid = [[
@@ -478,7 +479,7 @@ describe('ext_hlstate detailed highlights', function()
},
}
- t.feed('3ggV2jd')
+ n.feed('3ggV2jd')
--screen:redraw_debug()
screen:expect {
grid = [[
@@ -512,7 +513,7 @@ describe('ext_hlstate detailed highlights', function()
end
insert('last line')
- t.feed('gg')
+ n.feed('gg')
screen:expect {
grid = [[
^first line |
@@ -555,7 +556,7 @@ describe('ext_hlstate detailed highlights', function()
},
}
- t.feed(string.format('3ggV%ijd', num_lines - 2))
+ n.feed(string.format('3ggV%ijd', num_lines - 2))
--screen:redraw_debug(nil, nil, 100000)
local expected_ids = {}
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 6463814877..6bcfae2eee 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -1,22 +1,24 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local expect = t.expect
-local feed = t.feed
-local insert = t.insert
-local fn = t.fn
-local api = t.api
+local eval = n.eval
+local expect = n.expect
+local feed = n.feed
+local insert = n.insert
+local fn = n.fn
+local api = n.api
local neq = t.neq
local ok = t.ok
local retry = t.retry
-local source = t.source
-local poke_eventloop = t.poke_eventloop
+local source = n.source
+local poke_eventloop = n.poke_eventloop
local sleep = vim.uv.sleep
-local testprg = t.testprg
-local assert_alive = t.assert_alive
+local testprg = n.testprg
+local assert_alive = n.assert_alive
local default_text = [[
Inc substitution on
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua
index 6a11c8e9a7..12f3640b54 100644
--- a/test/functional/ui/inccommand_user_spec.lua
+++ b/test/functional/ui/inccommand_user_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local api = t.api
-local clear = t.clear
+
+local api = n.api
+local clear = n.clear
local eq = t.eq
-local exec_lua = t.exec_lua
-local insert = t.insert
-local feed = t.feed
-local command = t.command
-local assert_alive = t.assert_alive
+local exec_lua = n.exec_lua
+local insert = n.insert
+local feed = n.feed
+local command = n.command
+local assert_alive = n.assert_alive
-- Implements a :Replace command that works like :substitute and has multibuffer support.
local setup_replace_cmd = [[
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 8becaf918b..f377939458 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,16 +1,18 @@
-local t = require('test.functional.testutil')()
-local clear, feed_command = t.clear, t.feed_command
-local feed, next_msg, eq = t.feed, t.next_msg, t.eq
-local command = t.command
-local expect = t.expect
-local curbuf_contents = t.curbuf_contents
-local api = t.api
-local exec_lua = t.exec_lua
-local write_file = t.write_file
-local fn = t.fn
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local clear, feed_command = n.clear, n.feed_command
+local feed, next_msg, eq = n.feed, n.next_msg, t.eq
+local command = n.command
+local expect = n.expect
+local curbuf_contents = n.curbuf_contents
+local api = n.api
+local exec_lua = n.exec_lua
+local write_file = t.write_file
+local fn = n.fn
+local eval = n.eval
+
before_each(clear)
describe('mappings', function()
diff --git a/test/functional/ui/linematch_spec.lua b/test/functional/ui/linematch_spec.lua
index 475f9c524b..03eed5a49c 100644
--- a/test/functional/ui/linematch_spec.lua
+++ b/test/functional/ui/linematch_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed = t.feed
-local clear = t.clear
+local feed = n.feed
+local clear = n.clear
local write_file = t.write_file
describe('Diff mode screen with 3 diffs open', function()
@@ -1094,10 +1095,10 @@ describe('regressions', function()
screen = Screen.new(100, 20)
screen:attach()
-- line must be greater than MATCH_CHAR_MAX_LEN
- t.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' })
- t.exec 'vnew'
- t.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' })
- t.exec 'windo diffthis'
+ n.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' })
+ n.exec 'vnew'
+ n.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' })
+ n.exec 'windo diffthis'
end)
it('properly computes filler lines for hunks bigger than linematch limit', function()
@@ -1109,10 +1110,10 @@ describe('regressions', function()
for i = 0, 29 do
lines[#lines + 1] = tostring(i)
end
- t.api.nvim_buf_set_lines(0, 0, -1, false, lines)
- t.exec 'vnew'
- t.api.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' })
- t.exec 'windo diffthis'
+ n.api.nvim_buf_set_lines(0, 0, -1, false, lines)
+ n.exec 'vnew'
+ n.api.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' })
+ n.exec 'windo diffthis'
feed('<C-e>')
screen:expect {
grid = [[
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 9fa700c104..ca52a265fa 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -1,25 +1,27 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed = t.clear, t.feed
-local eval = t.eval
+
+local clear, feed = n.clear, n.feed
+local eval = n.eval
local eq = t.eq
local neq = t.neq
-local command = t.command
-local set_method_error = t.set_method_error
-local api = t.api
-local async_meths = t.async_meths
+local command = n.command
+local set_method_error = n.set_method_error
+local api = n.api
+local async_meths = n.async_meths
local test_build_dir = t.paths.test_build_dir
-local nvim_prog = t.nvim_prog
-local testprg = t.testprg
-local exec = t.exec
-local exec_capture = t.exec_capture
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local poke_eventloop = t.poke_eventloop
-local assert_alive = t.assert_alive
+local nvim_prog = n.nvim_prog
+local testprg = n.testprg
+local exec = n.exec
+local exec_capture = n.exec_capture
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local poke_eventloop = n.poke_eventloop
+local assert_alive = n.assert_alive
local retry = t.retry
local is_os = t.is_os
-local fn = t.fn
+local fn = n.fn
local skip = t.skip
describe('ui/ext_messages', function()
@@ -2723,13 +2725,13 @@ end)
it('pager works in headless mode with UI attached', function()
skip(is_os('win'))
clear()
- local child_server = assert(t.new_pipename())
+ local child_server = assert(n.new_pipename())
fn.jobstart({ nvim_prog, '--clean', '--headless', '--listen', child_server })
retry(nil, nil, function()
neq(nil, vim.uv.fs_stat(child_server))
end)
- local child_session = t.connect(child_server)
+ local child_session = n.connect(child_server)
local child_screen = Screen.new(40, 6)
child_screen:attach(nil, child_session)
child_screen._default_attr_ids = nil -- TODO: unskip with new color scheme
diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua
index d301660b45..f623cfda06 100644
--- a/test/functional/ui/mode_spec.lua
+++ b/test/functional/ui/mode_spec.lua
@@ -1,8 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command = t.command
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command = n.command
local retry = t.retry
describe('ui mode_change event', function()
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index a863b90549..42c877fd92 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, api = t.clear, t.feed, t.api
-local insert, feed_command = t.insert, t.feed_command
-local eq, fn = t.eq, t.fn
-local poke_eventloop = t.poke_eventloop
-local command = t.command
-local exec = t.exec
+
+local clear, feed, api = n.clear, n.feed, n.api
+local insert, feed_command = n.insert, n.feed_command
+local eq, fn = t.eq, n.fn
+local poke_eventloop = n.poke_eventloop
+local command = n.command
+local exec = n.exec
describe('ui/mouse/input', function()
local screen
@@ -575,7 +577,7 @@ describe('ui/mouse/input', function()
:tabprevious |
]])
feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab
- t.poke_eventloop()
+ n.poke_eventloop()
feed('<LeftMouse><0,1>')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -1856,8 +1858,8 @@ describe('ui/mouse/input', function()
it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function()
feed('<MouseMove>')
- t.poke_eventloop()
- t.assert_alive()
+ n.poke_eventloop()
+ n.assert_alive()
end)
it('mousemodel=popup_setpos', function()
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index 5a6258ffd0..da9d13762c 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
-local feed_command = t.feed_command
-local insert = t.insert
-local fn = t.fn
-local api = t.api
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
+local feed_command = n.feed_command
+local insert = n.insert
+local fn = n.fn
+local api = n.api
local split = vim.split
local dedent = t.dedent
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 3b2e2194bd..b30d29fa55 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local feed, command, insert = t.feed, t.command, t.insert
+
+local clear = n.clear
+local feed, command, insert = n.feed, n.command, n.insert
local eq = t.eq
-local fn = t.fn
-local api = t.api
-local curwin = t.api.nvim_get_current_win
-local poke_eventloop = t.poke_eventloop
+local fn = n.fn
+local api = n.api
+local curwin = n.api.nvim_get_current_win
+local poke_eventloop = n.poke_eventloop
describe('ext_multigrid', function()
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index e081cbefe3..b40ff29dec 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
local shallowcopy = t.shallowcopy
-local eval = t.eval
+local eval = n.eval
describe('UI receives option updates', function()
local screen
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index b09f1e0d03..4f6454a0fb 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -1,18 +1,19 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local t = require('test.functional.testutil')()
local tt = require('test.functional.terminal.testutil')
-local assert_alive = t.assert_alive
-local mkdir, write_file, rmdir = t.mkdir, t.write_file, t.rmdir
+local assert_alive = n.assert_alive
+local mkdir, write_file, rmdir = t.mkdir, t.write_file, n.rmdir
local eq = t.eq
-local feed = t.feed
-local feed_command = t.feed_command
-local clear = t.clear
-local command = t.command
-local testprg = t.testprg
-local nvim_dir = t.nvim_dir
-local has_powershell = t.has_powershell
-local set_shell_powershell = t.set_shell_powershell
+local feed = n.feed
+local feed_command = n.feed_command
+local clear = n.clear
+local command = n.command
+local testprg = n.testprg
+local nvim_dir = n.nvim_dir
+local has_powershell = n.has_powershell
+local set_shell_powershell = n.set_shell_powershell
local skip = t.skip
local is_os = t.is_os
@@ -30,7 +31,7 @@ describe('shell command :!', function()
'--cmd',
'colorscheme vim',
'--cmd',
- t.nvim_set .. ' notermguicolors',
+ n.nvim_set .. ' notermguicolors',
})
screen:expect([[
{1: } |
@@ -81,7 +82,7 @@ describe('shell command :!', function()
{3:-- TERMINAL --} |
]],
{
- -- test/functional/testutil.lua defaults to background=light.
+ -- test/functional/testnvim.lua defaults to background=light.
[1] = { reverse = true },
[3] = { bold = true },
[10] = { foreground = 2 },
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 6ec098e8cd..c3abc10424 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -1,17 +1,19 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local clear, feed = t.clear, t.feed
-local source = t.source
-local insert = t.insert
-local api = t.api
-local async_meths = t.async_meths
-local command = t.command
-local fn = t.fn
+
+local assert_alive = n.assert_alive
+local clear, feed = n.clear, n.feed
+local source = n.source
+local insert = n.insert
+local api = n.api
+local async_meths = n.async_meths
+local command = n.command
+local fn = n.fn
local eq = t.eq
local pcall_err = t.pcall_err
-local exec_lua = t.exec_lua
-local exec = t.exec
+local exec_lua = n.exec_lua
+local exec = n.exec
describe('ui/ext_popupmenu', function()
local screen
diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua
index 1438d586e9..73923a153a 100644
--- a/test/functional/ui/quickfix_spec.lua
+++ b/test/functional/ui/quickfix_spec.lua
@@ -1,7 +1,8 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, api = t.clear, t.feed, t.api
-local insert, command = t.insert, t.command
+
+local clear, feed, api = n.clear, n.feed, n.api
+local insert, command = n.insert, n.command
describe('quickfix selection highlight', function()
local screen
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index a9b3fb80d3..4625ce8553 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -70,17 +70,19 @@
-- To help write screen tests, see Screen:snapshot_util().
-- To debug screen tests, see Screen:redraw_debug().
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local busted = require('busted')
+
local deepcopy = vim.deepcopy
local shallowcopy = t.shallowcopy
local concat_tables = t.concat_tables
local pesc = vim.pesc
-local run_session = t.run_session
+local run_session = n.run_session
local eq = t.eq
local dedent = t.dedent
-local get_session = t.get_session
-local create_callindex = t.create_callindex
+local get_session = n.get_session
+local create_callindex = n.create_callindex
local inspect = vim.inspect
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 1bbe845bdd..54580bf47c 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local spawn, set_session, clear = t.spawn, t.set_session, t.clear
-local feed, command = t.feed, t.command
-local insert = t.insert
+
+local spawn, set_session, clear = n.spawn, n.set_session, n.clear
+local feed, command = n.feed, n.command
+local insert = n.insert
local eq = t.eq
-local fn, api = t.fn, t.api
+local fn, api = n.fn, n.api
describe('screen', function()
local screen
local nvim_argv = {
- t.nvim_prog,
+ n.nvim_prog,
'-u',
'NONE',
'-i',
@@ -700,7 +702,7 @@ describe('Screen default colors', function()
local extra = (light and ' background=light') or ''
local nvim_argv = {
- t.nvim_prog,
+ n.nvim_prog,
'-u',
'NONE',
'-i',
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 8a5529567b..8bdf528412 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, insert = t.clear, t.feed, t.insert
-local command = t.command
-local feed_command = t.feed_command
+
+local clear, feed, insert = n.clear, n.feed, n.insert
+local command = n.command
+local feed_command = n.feed_command
local eq = t.eq
-local eval = t.eval
-local fn = t.fn
-local testprg = t.testprg
+local eval = n.eval
+local fn = n.fn
+local testprg = n.testprg
describe('search highlighting', function()
local screen
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index a2eb6124ee..c1fc5ac538 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local api, clear, eq = t.api, t.clear, t.eq
-local eval, exec, feed = t.eval, t.exec, t.feed
+
+local api, clear, eq = n.api, n.clear, t.eq
+local eval, exec, feed = n.eval, n.exec, n.feed
describe('Signs', function()
local screen
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index a5952b5c05..da112148cd 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -1,12 +1,14 @@
-- Test for scenarios involving 'spell'
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local exec = t.exec
-local feed = t.feed
-local insert = t.insert
-local api = t.api
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local insert = n.insert
+local api = n.api
local is_os = t.is_os
describe("'spell'", function()
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index cf5126ad5c..cce9cca2ca 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local exec = t.exec
-local eval = t.eval
-local exec_lua = t.exec_lua
-local feed = t.feed
-local api = t.api
+local exec = n.exec
+local eval = n.eval
+local exec_lua = n.exec_lua
+local feed = n.feed
+local api = n.api
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local mousemodels = { 'extend', 'popup', 'popup_setpos' }
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 3c65cd46a9..3087a0cde1 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -1,15 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+
+local assert_alive = n.assert_alive
+local clear = n.clear
+local command = n.command
+local feed = n.feed
local eq = t.eq
-local fn = t.fn
-local api = t.api
-local exec = t.exec
-local exec_lua = t.exec_lua
-local eval = t.eval
+local fn = n.fn
+local api = n.api
+local exec = n.exec
+local exec_lua = n.exec_lua
+local eval = n.eval
local sleep = vim.uv.sleep
local pcall_err = t.pcall_err
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index fea03ca6a3..be35e9bf4f 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, command = t.clear, t.feed, t.command
+
+local clear, feed, command = n.clear, n.feed, n.command
local eq = t.eq
-local insert = t.insert
-local poke_eventloop = t.poke_eventloop
-local exec = t.exec
+local insert = n.insert
+local poke_eventloop = n.poke_eventloop
+local exec = n.exec
describe('Screen', function()
local screen
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index db6b0d7f91..5cda70df21 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -1,9 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, command, eq = t.clear, t.command, t.eq
-local insert = t.insert
-local api = t.api
-local assert_alive = t.assert_alive
+
+local clear, command, eq = n.clear, n.command, t.eq
+local insert = n.insert
+local api = n.api
+local assert_alive = n.assert_alive
describe('ui/ext_tabline', function()
local screen
diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua
index 09c6372573..e86fdbe5a3 100644
--- a/test/functional/ui/title_spec.lua
+++ b/test/functional/ui/title_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local curwin = t.api.nvim_get_current_win
+
+local clear = n.clear
+local command = n.command
+local curwin = n.api.nvim_get_current_win
local eq = t.eq
-local exec_lua = t.exec_lua
-local feed = t.feed
-local fn = t.fn
-local api = t.api
+local exec_lua = n.exec_lua
+local feed = n.feed
+local fn = n.fn
+local api = n.api
local is_os = t.is_os
describe('title', function()
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 477db0fb9b..0feec6bd03 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, feed, command = t.clear, t.feed, t.command
-local fn = t.fn
-local api = t.api
+
+local clear, feed, command = n.clear, n.feed, n.command
+local fn = n.fn
+local api = n.api
local eq = t.eq
-local eval = t.eval
+local eval = n.eval
local retry = t.retry
-local testprg = t.testprg
+local testprg = n.testprg
local is_os = t.is_os
describe("'wildmenu'", function()
diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua
index f41abff88c..fb907026a5 100644
--- a/test/functional/ui/winbar_spec.lua
+++ b/test/functional/ui/winbar_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local insert = t.insert
-local api = t.api
+
+local clear = n.clear
+local command = n.command
+local insert = n.insert
+local api = n.api
local eq = t.eq
-local poke_eventloop = t.poke_eventloop
-local feed = t.feed
-local fn = t.fn
+local poke_eventloop = n.poke_eventloop
+local feed = n.feed
+local fn = n.fn
local pcall_err = t.pcall_err
describe('winbar', function()
diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua
index bb10db8cd3..40d96ec281 100644
--- a/test/functional/vimscript/api_functions_spec.lua
+++ b/test/functional/vimscript/api_functions_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local neq, eq, command = t.neq, t.eq, t.command
-local clear = t.clear
-local exc_exec, expect, eval = t.exc_exec, t.expect, t.eval
-local exec_lua = t.exec_lua
-local insert, pcall_err = t.insert, t.pcall_err
+
+local neq, eq, command = t.neq, t.eq, n.command
+local clear = n.clear
+local exc_exec, expect, eval = n.exc_exec, n.expect, n.eval
+local exec_lua = n.exec_lua
+local insert, pcall_err = n.insert, t.pcall_err
local matches = t.matches
-local api = t.api
-local feed = t.feed
+local api = n.api
+local feed = n.feed
describe('eval-API', function()
before_each(clear)
diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua
index 4889db0cb7..625fbe7e03 100644
--- a/test/functional/vimscript/buf_functions_spec.lua
+++ b/test/functional/vimscript/buf_functions_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local fn = t.fn
-local api = t.api
-local command = t.command
-local exc_exec = t.exc_exec
-local get_pathsep = t.get_pathsep
-local rmdir = t.rmdir
+local clear = n.clear
+local fn = n.fn
+local api = n.api
+local command = n.command
+local exc_exec = n.exc_exec
+local get_pathsep = n.get_pathsep
+local rmdir = n.rmdir
local pcall_err = t.pcall_err
local mkdir = t.mkdir
diff --git a/test/functional/vimscript/changedtick_spec.lua b/test/functional/vimscript/changedtick_spec.lua
index ad8d42b4d5..baea53a700 100644
--- a/test/functional/vimscript/changedtick_spec.lua
+++ b/test/functional/vimscript/changedtick_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
-local clear = t.clear
-local fn = t.fn
-local api = t.api
-local command = t.command
-local exc_exec = t.exc_exec
+local eval = n.eval
+local feed = n.feed
+local clear = n.clear
+local fn = n.fn
+local api = n.api
+local command = n.command
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
-local exec_capture = t.exec_capture
+local exec_capture = n.exec_capture
before_each(clear)
diff --git a/test/functional/vimscript/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua
index a1bbee1e15..1d95bf6470 100644
--- a/test/functional/vimscript/container_functions_spec.lua
+++ b/test/functional/vimscript/container_functions_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local eval = t.eval
-local api = t.api
-local clear = t.clear
+local eval = n.eval
+local api = n.api
+local clear = n.clear
before_each(clear)
diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua
index 956abe12e6..5e9a803b5d 100644
--- a/test/functional/vimscript/ctx_functions_spec.lua
+++ b/test/functional/vimscript/ctx_functions_spec.lua
@@ -1,16 +1,17 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local call = t.call
-local clear = t.clear
-local command = t.command
+local call = n.call
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local feed = t.feed
+local eval = n.eval
+local feed = n.feed
local map = vim.tbl_map
-local api = t.api
-local parse_context = t.parse_context
-local exec_capture = t.exec_capture
-local source = t.source
+local api = n.api
+local parse_context = n.parse_context
+local exec_capture = n.exec_capture
+local source = n.source
local trim = vim.trim
local write_file = t.write_file
local pcall_err = t.pcall_err
diff --git a/test/functional/vimscript/environ_spec.lua b/test/functional/vimscript/environ_spec.lua
index 9ef0edd815..abb093a6c8 100644
--- a/test/functional/vimscript/environ_spec.lua
+++ b/test/functional/vimscript/environ_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local environ = t.fn.environ
-local exists = t.fn.exists
-local system = t.fn.system
-local nvim_prog = t.nvim_prog
-local command = t.command
-local eval = t.eval
-local setenv = t.fn.setenv
+local environ = n.fn.environ
+local exists = n.fn.exists
+local system = n.fn.system
+local nvim_prog = n.nvim_prog
+local command = n.command
+local eval = n.eval
+local setenv = n.fn.setenv
describe('environment variables', function()
it('environ() handles empty env variable', function()
diff --git a/test/functional/vimscript/errorlist_spec.lua b/test/functional/vimscript/errorlist_spec.lua
index 4e473b9e44..ef9111f788 100644
--- a/test/functional/vimscript/errorlist_spec.lua
+++ b/test/functional/vimscript/errorlist_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local exc_exec = t.exc_exec
-local get_win_var = t.api.nvim_win_get_var
+local exc_exec = n.exc_exec
+local get_win_var = n.api.nvim_win_get_var
describe('setqflist()', function()
- local setqflist = t.fn.setqflist
+ local setqflist = n.fn.setqflist
before_each(clear)
@@ -46,7 +47,7 @@ describe('setqflist()', function()
end)
describe('setloclist()', function()
- local setloclist = t.fn.setloclist
+ local setloclist = n.fn.setloclist
before_each(clear)
@@ -73,7 +74,7 @@ describe('setloclist()', function()
end)
it("doesn't crash when when window is closed in the middle #13721", function()
- t.insert([[
+ n.insert([[
hello world]])
command('vsplit')
@@ -82,6 +83,6 @@ describe('setloclist()', function()
command('call setloclist(0, [])')
command('lopen')
- t.assert_alive()
+ n.assert_alive()
end)
end)
diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua
index b7c0803ef7..0c812d968e 100644
--- a/test/functional/vimscript/eval_spec.lua
+++ b/test/functional/vimscript/eval_spec.lua
@@ -9,37 +9,38 @@
-- test/functional/vimscript/<funcname>_spec.lua
-- test/functional/vimscript/functions_spec.lua
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local mkdir = t.mkdir
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local exec = t.exec
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local exec_capture = t.exec_capture
-local eval = t.eval
-local command = t.command
+local exec = n.exec
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local exec_capture = n.exec_capture
+local eval = n.eval
+local command = n.command
local write_file = t.write_file
-local api = t.api
+local api = n.api
local sleep = vim.uv.sleep
local matches = t.matches
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
-local poke_eventloop = t.poke_eventloop
-local feed = t.feed
-local expect_exit = t.expect_exit
+local assert_alive = n.assert_alive
+local poke_eventloop = n.poke_eventloop
+local feed = n.feed
+local expect_exit = n.expect_exit
describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
local max_func_args = 20 -- from eval.h
- local range = t.fn.range
+ local range = n.fn.range
before_each(clear)
it('printf()', function()
- local printf = t.fn.printf
- local rep = t.fn['repeat']
+ local printf = n.fn.printf
+ local rep = n.fn['repeat']
local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,'
eq(expected, printf(rep('%d,', max_func_args - 1), unpack(range(2, max_func_args))))
local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
@@ -47,7 +48,7 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
end)
it('rpcnotify()', function()
- local rpcnotify = t.fn.rpcnotify
+ local rpcnotify = n.fn.rpcnotify
local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args)))
eq(1, ret)
ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
@@ -69,7 +70,7 @@ describe('backtick expansion', function()
end)
teardown(function()
- t.rmdir('test-backticks')
+ n.rmdir('test-backticks')
end)
it("with default 'shell'", function()
diff --git a/test/functional/vimscript/executable_spec.lua b/test/functional/vimscript/executable_spec.lua
index 75d36c26d9..e5530926c4 100644
--- a/test/functional/vimscript/executable_spec.lua
+++ b/test/functional/vimscript/executable_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local eq, clear, call, write_file, command = t.eq, t.clear, t.call, t.write_file, t.command
-local exc_exec = t.exc_exec
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, clear, call, write_file, command = t.eq, n.clear, n.call, t.write_file, n.command
+local exc_exec = n.exc_exec
+local eval = n.eval
local is_os = t.is_os
describe('executable()', function()
diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua
index 32477323a1..8caaea39a7 100644
--- a/test/functional/vimscript/execute_spec.lua
+++ b/test/functional/vimscript/execute_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
+
local eq = t.eq
-local eval = t.eval
-local clear = t.clear
-local source = t.source
-local exc_exec = t.exc_exec
+local eval = n.eval
+local clear = n.clear
+local source = n.source
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
-local fn = t.fn
-local Screen = require('test.functional.ui.screen')
-local command = t.command
-local feed = t.feed
+local fn = n.fn
+local command = n.command
+local feed = n.feed
local is_os = t.is_os
describe('execute()', function()
diff --git a/test/functional/vimscript/exepath_spec.lua b/test/functional/vimscript/exepath_spec.lua
index a1a2afb4ed..97747619ad 100644
--- a/test/functional/vimscript/exepath_spec.lua
+++ b/test/functional/vimscript/exepath_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local eq, clear, call = t.eq, t.clear, t.call
-local command = t.command
-local exc_exec = t.exc_exec
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local eq, clear, call = t.eq, n.clear, n.call
+local command = n.command
+local exc_exec = n.exc_exec
local matches = t.matches
local is_os = t.is_os
-local set_shell_powershell = t.set_shell_powershell
-local eval = t.eval
+local set_shell_powershell = n.set_shell_powershell
+local eval = n.eval
local find_dummies = function(ext_pat)
local tmp_path = eval('$PATH')
diff --git a/test/functional/vimscript/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua
index fd2c79d9a5..51b1e8489a 100644
--- a/test/functional/vimscript/fnamemodify_spec.lua
+++ b/test/functional/vimscript/fnamemodify_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local fnamemodify = t.fn.fnamemodify
-local getcwd = t.fn.getcwd
-local command = t.command
+local fnamemodify = n.fn.fnamemodify
+local getcwd = n.fn.getcwd
+local command = n.command
local write_file = t.write_file
-local alter_slashes = t.alter_slashes
+local alter_slashes = n.alter_slashes
local is_os = t.is_os
local function eq_slashconvert(expected, got)
@@ -24,7 +26,7 @@ describe('fnamemodify()', function()
end)
it('handles the root path', function()
- local root = t.pathroot()
+ local root = n.pathroot()
eq(root, fnamemodify([[/]], ':p:h'))
eq(root, fnamemodify([[/]], ':p'))
if is_os('win') then
diff --git a/test/functional/vimscript/functions_spec.lua b/test/functional/vimscript/functions_spec.lua
index 1d57b60b95..7d9e80a32b 100644
--- a/test/functional/vimscript/functions_spec.lua
+++ b/test/functional/vimscript/functions_spec.lua
@@ -5,10 +5,11 @@
--
-- Core "eval" tests live in eval_spec.lua.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local eval = t.eval
+local clear = n.clear
+local eval = n.eval
local matches = t.matches
local is_os = t.is_os
diff --git a/test/functional/vimscript/getline_spec.lua b/test/functional/vimscript/getline_spec.lua
index 18f7eabc25..32be6b5702 100644
--- a/test/functional/vimscript/getline_spec.lua
+++ b/test/functional/vimscript/getline_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local call = t.call
-local clear = t.clear
+local call = n.call
+local clear = n.clear
local eq = t.eq
-local expect = t.expect
+local expect = n.expect
describe('getline()', function()
before_each(function()
diff --git a/test/functional/vimscript/glob_spec.lua b/test/functional/vimscript/glob_spec.lua
index c66865611f..754381231e 100644
--- a/test/functional/vimscript/glob_spec.lua
+++ b/test/functional/vimscript/glob_spec.lua
@@ -1,5 +1,7 @@
-local t = require('test.functional.testutil')()
-local clear, command, eval, eq = t.clear, t.command, t.eval, t.eq
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, command, eval, eq = n.clear, n.command, n.eval, t.eq
local mkdir = t.mkdir
before_each(function()
diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua
index 05d5b04a29..1d2187be6b 100644
--- a/test/functional/vimscript/has_spec.lua
+++ b/test/functional/vimscript/has_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local connect = t.connect
+
+local clear = n.clear
+local connect = n.connect
local eq = t.eq
-local fn = t.fn
+local fn = n.fn
local is_os = t.is_os
-local nvim_prog = t.nvim_prog
+local nvim_prog = n.nvim_prog
describe('has()', function()
before_each(clear)
diff --git a/test/functional/vimscript/hostname_spec.lua b/test/functional/vimscript/hostname_spec.lua
index e5be1cf4c3..e6b2499775 100644
--- a/test/functional/vimscript/hostname_spec.lua
+++ b/test/functional/vimscript/hostname_spec.lua
@@ -1,8 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
local ok = t.ok
-local call = t.call
-local clear = t.clear
+local call = n.call
+local clear = n.clear
local is_os = t.is_os
describe('hostname()', function()
diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua
index e974d71356..552ae6d5cc 100644
--- a/test/functional/vimscript/input_spec.lua
+++ b/test/functional/vimscript/input_spec.lua
@@ -1,14 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
-local feed = t.feed
-local api = t.api
-local clear = t.clear
-local source = t.source
-local command = t.command
-local exc_exec = t.exc_exec
-local async_meths = t.async_meths
+local feed = n.feed
+local api = n.api
+local clear = n.clear
+local source = n.source
+local command = n.command
+local exc_exec = n.exc_exec
+local async_meths = n.async_meths
local NIL = vim.NIL
local screen
diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua
index f17cf7017c..ae56e8873d 100644
--- a/test/functional/vimscript/json_functions_spec.lua
+++ b/test/functional/vimscript/json_functions_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local fn = t.fn
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local fn = n.fn
+local api = n.api
local eq = t.eq
-local eval = t.eval
-local command = t.command
-local exc_exec = t.exc_exec
+local eval = n.eval
+local command = n.command
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
local NIL = vim.NIL
-local source = t.source
+local source = n.source
describe('json_decode() function', function()
local restart = function(...)
diff --git a/test/functional/vimscript/lang_spec.lua b/test/functional/vimscript/lang_spec.lua
index bb6b3ea5a7..923c8c215d 100644
--- a/test/functional/vimscript/lang_spec.lua
+++ b/test/functional/vimscript/lang_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, eval, eq = t.clear, t.eval, t.eq
-local exc_exec, source = t.exc_exec, t.source
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eval, eq = n.clear, n.eval, t.eq
+local exc_exec, source = n.exc_exec, n.source
describe('vimscript', function()
before_each(clear)
diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua
index f8b9ba89d0..412e06df20 100644
--- a/test/functional/vimscript/let_spec.lua
+++ b/test/functional/vimscript/let_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local command = t.command
-local eval = t.eval
-local api = t.api
-local exec = t.exec
-local exec_capture = t.exec_capture
-local expect_exit = t.expect_exit
-local source = t.source
-local testprg = t.testprg
+local clear = n.clear
+local command = n.command
+local eval = n.eval
+local api = n.api
+local exec = n.exec
+local exec_capture = n.exec_capture
+local expect_exit = n.expect_exit
+local source = n.source
+local testprg = n.testprg
before_each(clear)
diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua
index 249b79aa4e..44be5b3185 100644
--- a/test/functional/vimscript/map_functions_spec.lua
+++ b/test/functional/vimscript/map_functions_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local exec = t.exec
-local exec_lua = t.exec_lua
-local expect = t.expect
-local feed = t.feed
-local fn = t.fn
-local api = t.api
-local source = t.source
-local command = t.command
-local exec_capture = t.exec_capture
+local eval = n.eval
+local exec = n.exec
+local exec_lua = n.exec_lua
+local expect = n.expect
+local feed = n.feed
+local fn = n.fn
+local api = n.api
+local source = n.source
+local command = n.command
+local exec_capture = n.exec_capture
local pcall_err = t.pcall_err
describe('maparg()', function()
diff --git a/test/functional/vimscript/match_functions_spec.lua b/test/functional/vimscript/match_functions_spec.lua
index 98a2169676..87c57f1c15 100644
--- a/test/functional/vimscript/match_functions_spec.lua
+++ b/test/functional/vimscript/match_functions_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local eq = t.eq
-local clear = t.clear
-local fn = t.fn
-local command = t.command
-local exc_exec = t.exc_exec
+local clear = n.clear
+local fn = n.fn
+local command = n.command
+local exc_exec = n.exc_exec
before_each(clear)
diff --git a/test/functional/vimscript/minmax_functions_spec.lua b/test/functional/vimscript/minmax_functions_spec.lua
index 1748c97849..bf223c436e 100644
--- a/test/functional/vimscript/minmax_functions_spec.lua
+++ b/test/functional/vimscript/minmax_functions_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local eval = t.eval
-local command = t.command
-local clear = t.clear
-local fn = t.fn
+local eval = n.eval
+local command = n.command
+local clear = n.clear
+local fn = n.fn
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/vimscript/modeline_spec.lua b/test/functional/vimscript/modeline_spec.lua
index 7dfaba217b..53a5e9b692 100644
--- a/test/functional/vimscript/modeline_spec.lua
+++ b/test/functional/vimscript/modeline_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local assert_alive = t.assert_alive
-local clear, command, write_file = t.clear, t.command, t.write_file
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local assert_alive = n.assert_alive
+local clear, command, write_file = n.clear, n.command, t.write_file
describe('modeline', function()
local tempfile = t.tmpname()
diff --git a/test/functional/vimscript/msgpack_functions_spec.lua b/test/functional/vimscript/msgpack_functions_spec.lua
index c945efab5a..d59dceef31 100644
--- a/test/functional/vimscript/msgpack_functions_spec.lua
+++ b/test/functional/vimscript/msgpack_functions_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
-local fn = t.fn
-local eval, eq = t.eval, t.eq
-local command = t.command
-local api = t.api
-local exc_exec = t.exc_exec
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local fn = n.fn
+local eval, eq = n.eval, t.eq
+local command = n.command
+local api = n.api
+local exc_exec = n.exc_exec
local is_os = t.is_os
describe('msgpack*() functions', function()
@@ -469,12 +471,12 @@ describe('msgpackparse() function', function()
end)
it('msgpackparse(systemlist(...)) does not segfault. #3135', function()
- local cmd = "sort(keys(msgpackparse(systemlist('" .. t.nvim_prog .. " --api-info'))[0]))"
+ local cmd = "sort(keys(msgpackparse(systemlist('" .. n.nvim_prog .. " --api-info'))[0]))"
eval(cmd)
eval(cmd) -- do it again (try to force segfault)
local api_info = eval(cmd) -- do it again
if is_os('win') then
- t.assert_alive()
+ n.assert_alive()
pending('msgpackparse() has a bug on windows')
return
end
diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua
index fc051371ba..9a27239a6d 100644
--- a/test/functional/vimscript/null_spec.lua
+++ b/test/functional/vimscript/null_spec.lua
@@ -1,10 +1,11 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local exc_exec = t.exc_exec
-local command = t.command
-local clear = t.clear
-local api = t.api
-local fn = t.fn
+local exc_exec = n.exc_exec
+local command = n.command
+local clear = n.clear
+local api = n.api
+local fn = n.fn
local eq = t.eq
local function redir_exec(cmd)
diff --git a/test/functional/vimscript/operators_spec.lua b/test/functional/vimscript/operators_spec.lua
index b6294f1f5a..9c4a91d655 100644
--- a/test/functional/vimscript/operators_spec.lua
+++ b/test/functional/vimscript/operators_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local eq = t.eq
-local eval = t.eval
-local clear = t.clear
+local eval = n.eval
+local clear = n.clear
describe('Division operator', function()
before_each(clear)
diff --git a/test/functional/vimscript/printf_spec.lua b/test/functional/vimscript/printf_spec.lua
index 027edd3b3a..3c66e07618 100644
--- a/test/functional/vimscript/printf_spec.lua
+++ b/test/functional/vimscript/printf_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local eval = t.eval
-local fn = t.fn
-local api = t.api
-local exc_exec = t.exc_exec
+local eval = n.eval
+local fn = n.fn
+local api = n.api
+local exc_exec = n.exc_exec
describe('printf()', function()
before_each(clear)
diff --git a/test/functional/vimscript/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua
index 4d77c911e4..fa110d602a 100644
--- a/test/functional/vimscript/reltime_spec.lua
+++ b/test/functional/vimscript/reltime_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, eq, ok = t.clear, t.eq, t.ok
-local neq, command, fn = t.neq, t.command, t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, ok = n.clear, t.eq, t.ok
+local neq, command, fn = t.neq, n.command, n.fn
local matches = t.matches
local reltime, reltimestr, reltimefloat = fn.reltime, fn.reltimestr, fn.reltimefloat
diff --git a/test/functional/vimscript/screenchar_spec.lua b/test/functional/vimscript/screenchar_spec.lua
index 442d7904a0..b6137d7741 100644
--- a/test/functional/vimscript/screenchar_spec.lua
+++ b/test/functional/vimscript/screenchar_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, eq, neq = t.clear, t.eq, t.neq
-local command, api, fn = t.command, t.api, t.fn
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, neq = n.clear, t.eq, t.neq
+local command, api, fn = n.command, n.api, n.fn
local tbl_deep_extend = vim.tbl_deep_extend
-- Set up two overlapping floating windows
diff --git a/test/functional/vimscript/screenpos_spec.lua b/test/functional/vimscript/screenpos_spec.lua
index 057e740205..630e19b841 100644
--- a/test/functional/vimscript/screenpos_spec.lua
+++ b/test/functional/vimscript/screenpos_spec.lua
@@ -1,7 +1,9 @@
-local t = require('test.functional.testutil')()
-local clear, eq, api = t.clear, t.eq, t.api
-local command, fn = t.command, t.fn
-local feed = t.feed
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, api = n.clear, t.eq, n.api
+local command, fn = n.command, n.fn
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua
index a079429730..4b0dc087f6 100644
--- a/test/functional/vimscript/server_spec.lua
+++ b/test/functional/vimscript/server_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local assert_log = t.assert_log
-local eq, neq, eval = t.eq, t.neq, t.eval
-local clear, fn, api = t.clear, t.fn, t.api
+local eq, neq, eval = t.eq, t.neq, n.eval
+local clear, fn, api = n.clear, n.fn, n.api
local ok = t.ok
local matches = t.matches
local pcall_err = t.pcall_err
-local check_close = t.check_close
+local check_close = n.check_close
local mkdir = t.mkdir
-local rmdir = t.rmdir
+local rmdir = n.rmdir
local is_os = t.is_os
local testlog = 'Xtest-server-log'
@@ -148,7 +150,7 @@ describe('server', function()
it('serverlist() returns the list of servers', function()
clear()
-- There should already be at least one server.
- local n = eval('len(serverlist())')
+ local _n = eval('len(serverlist())')
-- Add some servers.
local servs = (
@@ -162,25 +164,25 @@ describe('server', function()
local new_servs = eval('serverlist()')
-- Exactly #servs servers should be added.
- eq(n + #servs, #new_servs)
+ eq(_n + #servs, #new_servs)
-- The new servers should be at the end of the list.
for i = 1, #servs do
- eq(servs[i], new_servs[i + n])
+ eq(servs[i], new_servs[i + _n])
eq(1, eval("serverstop('" .. servs[i] .. "')"))
end
-- After serverstop() the servers should NOT be in the list.
- eq(n, eval('len(serverlist())'))
+ eq(_n, eval('len(serverlist())'))
end)
end)
describe('startup --listen', function()
it('validates', function()
clear()
- local cmd = { unpack(t.nvim_argv) }
+ local cmd = { unpack(n.nvim_argv) }
table.insert(cmd, '--listen')
matches('nvim.*: Argument missing after: "%-%-listen"', fn.system(cmd))
- cmd = { unpack(t.nvim_argv) }
+ cmd = { unpack(n.nvim_argv) }
table.insert(cmd, '--listen2')
matches('nvim.*: Garbage after option argument: "%-%-listen2"', fn.system(cmd))
end)
diff --git a/test/functional/vimscript/setpos_spec.lua b/test/functional/vimscript/setpos_spec.lua
index 16a974c511..968da4d8f4 100644
--- a/test/functional/vimscript/setpos_spec.lua
+++ b/test/functional/vimscript/setpos_spec.lua
@@ -1,12 +1,14 @@
-local t = require('test.functional.testutil')()
-local setpos = t.fn.setpos
-local getpos = t.fn.getpos
-local insert = t.insert
-local clear = t.clear
-local command = t.command
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local setpos = n.fn.setpos
+local getpos = n.fn.getpos
+local insert = n.insert
+local clear = n.clear
+local command = n.command
+local eval = n.eval
local eq = t.eq
-local exc_exec = t.exc_exec
+local exc_exec = n.exc_exec
describe('setpos() function', function()
before_each(function()
diff --git a/test/functional/vimscript/sort_spec.lua b/test/functional/vimscript/sort_spec.lua
index 539b74984c..c8c1651ed8 100644
--- a/test/functional/vimscript/sort_spec.lua
+++ b/test/functional/vimscript/sort_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
local NIL = vim.NIL
-local eval = t.eval
-local clear = t.clear
-local api = t.api
-local fn = t.fn
-local command = t.command
-local exc_exec = t.exc_exec
+local eval = n.eval
+local clear = n.clear
+local api = n.api
+local fn = n.fn
+local command = n.command
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua
index 0ce8703735..70e195ba0b 100644
--- a/test/functional/vimscript/special_vars_spec.lua
+++ b/test/functional/vimscript/special_vars_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local exc_exec = t.exc_exec
-local command = t.command
-local fn = t.fn
-local clear = t.clear
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local exc_exec = n.exc_exec
+local command = n.command
+local fn = n.fn
+local clear = n.clear
+local eval = n.eval
local eq = t.eq
-local api = t.api
+local api = n.api
local NIL = vim.NIL
describe('Special values', function()
diff --git a/test/functional/vimscript/state_spec.lua b/test/functional/vimscript/state_spec.lua
index 4a340f9717..211d79928a 100644
--- a/test/functional/vimscript/state_spec.lua
+++ b/test/functional/vimscript/state_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local exec = t.exec
-local exec_lua = t.exec_lua
-local feed = t.feed
-local api = t.api
-local poke_eventloop = t.poke_eventloop
+local exec = n.exec
+local exec_lua = n.exec_lua
+local feed = n.feed
+local api = n.api
+local poke_eventloop = n.poke_eventloop
before_each(clear)
diff --git a/test/functional/vimscript/string_spec.lua b/test/functional/vimscript/string_spec.lua
index c57e4e978b..32aa04c0d0 100644
--- a/test/functional/vimscript/string_spec.lua
+++ b/test/functional/vimscript/string_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq = t.eq
-local command = t.command
-local api = t.api
-local eval = t.eval
-local exc_exec = t.exc_exec
+local command = n.command
+local api = n.api
+local eval = n.eval
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
-local fn = t.fn
+local fn = n.fn
local NIL = vim.NIL
-local source = t.source
+local source = n.source
describe('string() function', function()
before_each(clear)
diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua
index 77ba4e8f97..792e4c46c3 100644
--- a/test/functional/vimscript/system_spec.lua
+++ b/test/functional/vimscript/system_spec.lua
@@ -1,21 +1,21 @@
-- Tests for system() and :! shell.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
-local assert_alive = t.assert_alive
-local testprg = t.testprg
+local assert_alive = n.assert_alive
+local testprg = n.testprg
local eq, call, clear, eval, feed_command, feed, api =
- t.eq, t.call, t.clear, t.eval, t.feed_command, t.feed, t.api
-local command = t.command
-local insert = t.insert
-local expect = t.expect
-local exc_exec = t.exc_exec
-local os_kill = t.os_kill
+ t.eq, n.call, n.clear, n.eval, n.feed_command, n.feed, n.api
+local command = n.command
+local insert = n.insert
+local expect = n.expect
+local exc_exec = n.exc_exec
+local os_kill = n.os_kill
local pcall_err = t.pcall_err
local is_os = t.is_os
-local Screen = require('test.functional.ui.screen')
-
local function create_file_with_nuls(name)
return function()
feed('ipart1<C-V>000part2<C-V>000part3<ESC>:w ' .. name .. '<CR>')
@@ -183,7 +183,7 @@ describe('system()', function()
end)
it('with powershell', function()
- t.set_shell_powershell()
+ n.set_shell_powershell()
eq('a\nb\n', eval([[system('Write-Output a b')]]))
eq('C:\\\n', eval([[system('cd c:\; (Get-Location).Path')]]))
eq('a b\n', eval([[system('Write-Output "a b"')]]))
@@ -191,11 +191,11 @@ describe('system()', function()
end
it('powershell w/ UTF-8 text #13713', function()
- if not t.has_powershell() then
+ if not n.has_powershell() then
pending('powershell not found', function() end)
return
end
- t.set_shell_powershell()
+ n.set_shell_powershell()
eq('ああ\n', eval([[system('Write-Output "ああ"')]]))
-- Sanity test w/ default encoding
-- * on Windows, expected to default to Western European enc
@@ -241,8 +241,8 @@ describe('system()', function()
feed(':edit ' .. tempfile .. '<cr>')
- local command_total_time = tonumber(t.fn.split(t.fn.getline(7))[2])
- local command_self_time = tonumber(t.fn.split(t.fn.getline(7))[3])
+ local command_total_time = tonumber(n.fn.split(n.fn.getline(7))[2])
+ local command_self_time = tonumber(n.fn.split(n.fn.getline(7))[3])
t.neq(nil, command_total_time)
t.neq(nil, command_self_time)
@@ -548,11 +548,11 @@ describe('systemlist()', function()
end)
it('powershell w/ UTF-8 text #13713', function()
- if not t.has_powershell() then
+ if not n.has_powershell() then
pending('powershell not found', function() end)
return
end
- t.set_shell_powershell()
+ n.set_shell_powershell()
eq({ is_os('win') and 'あ\r' or 'あ' }, eval([[systemlist('Write-Output あ')]]))
-- Sanity test w/ default encoding
-- * on Windows, expected to default to Western European enc
@@ -568,7 +568,7 @@ describe('shell :!', function()
it(':{range}! with powershell filter/redirect #16271 #19250', function()
local screen = Screen.new(500, 8)
screen:attach()
- local found = t.set_shell_powershell(true)
+ local found = n.set_shell_powershell(true)
insert([[
3
1
@@ -615,12 +615,12 @@ describe('shell :!', function()
}
end
feed('<CR>')
- t.set_shell_powershell(true)
+ n.set_shell_powershell(true)
feed(':4verbose %w !sort<cr>')
screen:expect {
any = [[Executing command: .?& { Get%-Content .* | & sort }]],
}
feed('<CR>')
- t.expect_exit(command, 'qall!')
+ n.expect_exit(command, 'qall!')
end)
end)
diff --git a/test/functional/vimscript/timer_spec.lua b/test/functional/vimscript/timer_spec.lua
index 6cd8590500..f075e382bc 100644
--- a/test/functional/vimscript/timer_spec.lua
+++ b/test/functional/vimscript/timer_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local feed, eq, eval, ok = t.feed, t.eq, t.eval, t.ok
-local source, async_meths, run = t.source, t.async_meths, t.run
-local clear, command, fn = t.clear, t.command, t.fn
-local exc_exec = t.exc_exec
-local api = t.api
-local load_adjust = t.load_adjust
+
+local feed, eq, eval, ok = n.feed, t.eq, n.eval, t.ok
+local source, async_meths, run = n.source, n.async_meths, n.run
+local clear, command, fn = n.clear, n.command, n.fn
+local exc_exec = n.exc_exec
+local api = n.api
+local load_adjust = n.load_adjust
local retry = t.retry
describe('timers', function()
diff --git a/test/functional/vimscript/uniq_spec.lua b/test/functional/vimscript/uniq_spec.lua
index 6ef6dd9960..4e1ef699a4 100644
--- a/test/functional/vimscript/uniq_spec.lua
+++ b/test/functional/vimscript/uniq_spec.lua
@@ -1,9 +1,10 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local eq = t.eq
-local clear = t.clear
-local command = t.command
-local exc_exec = t.exc_exec
+local clear = n.clear
+local command = n.command
+local exc_exec = n.exc_exec
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/vimscript/vvar_event_spec.lua b/test/functional/vimscript/vvar_event_spec.lua
index e8b8ff36c0..16fa2c9f9f 100644
--- a/test/functional/vimscript/vvar_event_spec.lua
+++ b/test/functional/vimscript/vvar_event_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, eval, eq = t.clear, t.eval, t.eq
-local command = t.command
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eval, eq = n.clear, n.eval, t.eq
+local command = n.command
describe('v:event', function()
before_each(clear)
it('is empty before any autocommand', function()
diff --git a/test/functional/vimscript/wait_spec.lua b/test/functional/vimscript/wait_spec.lua
index 81c406d0cc..0932bd3593 100644
--- a/test/functional/vimscript/wait_spec.lua
+++ b/test/functional/vimscript/wait_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local call = t.call
-local clear = t.clear
-local command = t.command
-local eval = t.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local call = n.call
+local clear = n.clear
+local command = n.command
+local eval = n.eval
local eq = t.eq
-local feed = t.feed
-local feed_command = t.feed_command
-local next_msg = t.next_msg
-local api = t.api
-local source = t.source
+local feed = n.feed
+local feed_command = n.feed_command
+local next_msg = n.next_msg
+local api = n.api
+local source = n.source
local pcall_err = t.pcall_err
before_each(function()
diff --git a/test/functional/vimscript/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua
index 6ad527d922..404aceb92b 100644
--- a/test/functional/vimscript/writefile_spec.lua
+++ b/test/functional/vimscript/writefile_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local mkdir = t.mkdir
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local fn = t.fn
-local api = t.api
-local exc_exec = t.exc_exec
+local fn = n.fn
+local api = n.api
+local exc_exec = n.exc_exec
local read_file = t.read_file
local write_file = t.write_file
local pcall_err = t.pcall_err
-local command = t.command
+local command = n.command
local fname = 'Xtest-functional-eval-writefile'
local dname = fname .. '.d'
diff --git a/test/old/testdir/load.vim b/test/old/testdir/load.vim
index 139fc933c0..58ec0b1356 100644
--- a/test/old/testdir/load.vim
+++ b/test/old/testdir/load.vim
@@ -1,4 +1,4 @@
-" Also used by: test/functional/testutil.lua
+" Also used by: test/functional/testnvim.lua
function! s:load_factor() abort
let timeout = 200
diff --git a/test/testutil.lua b/test/testutil.lua
index 337390c87b..439f13cf49 100644
--- a/test/testutil.lua
+++ b/test/testutil.lua
@@ -16,6 +16,7 @@ local function shell_quote(str)
return str
end
+--- This module uses functions from the context of the test runner.
--- @class test.testutil
local M = {
paths = Paths,
@@ -254,7 +255,7 @@ function M.pcall_err_withtrace(fn, ...)
return (
errmsg
- :gsub('^%.%.%./testutil%.lua:0: ', '')
+ :gsub('^%.%.%./testnvim%.lua:0: ', '')
:gsub('^Error executing lua:- ', '')
:gsub('^%[string "<nvim>"%]:0: ', '')
)
@@ -776,4 +777,54 @@ function M.mkdir(path)
return (uv.fs_mkdir(path, 493))
end
+--- @param expected any[]
+--- @param received any[]
+--- @param kind string
+--- @return any
+function M.expect_events(expected, received, kind)
+ if not pcall(M.eq, expected, received) then
+ local msg = 'unexpected ' .. kind .. ' received.\n\n'
+
+ msg = msg .. 'received events:\n'
+ for _, e in ipairs(received) do
+ msg = msg .. ' ' .. vim.inspect(e) .. ';\n'
+ end
+ msg = msg .. '\nexpected events:\n'
+ for _, e in ipairs(expected) do
+ msg = msg .. ' ' .. vim.inspect(e) .. ';\n'
+ end
+ M.fail(msg)
+ end
+ return received
+end
+
+--- @param cond boolean
+--- @param reason? string
+--- @return boolean
+function M.skip(cond, reason)
+ if cond then
+ --- @type fun(reason: string)
+ local pending = getfenv(2).pending
+ pending(reason or 'FIXME')
+ return true
+ end
+ return false
+end
+
+-- Calls pending() and returns `true` if the system is too slow to
+-- run fragile or expensive tests. Else returns `false`.
+function M.skip_fragile(pending_fn, cond)
+ if pending_fn == nil or type(pending_fn) ~= type(function() end) then
+ error('invalid pending_fn')
+ end
+ if cond then
+ pending_fn('skipped (test is fragile on this system)', function() end)
+ return true
+ elseif os.getenv('TEST_SKIP_FRAGILE') then
+ pending_fn('skipped (TEST_SKIP_FRAGILE)', function() end)
+ return true
+ end
+ return false
+end
+
return M