diff options
77 files changed, 1606 insertions, 1491 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f6c3513b7..1af79e60a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,15 +187,15 @@ include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS}) find_package(LuaJit REQUIRED) include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS}) -set(LIBUNIBILIUM_USE_STATIC ON) +option(LIBUNIBILIUM_USE_STATIC "Use static libunibilium" ON) find_package(LibUnibilium REQUIRED) include_directories(SYSTEM ${LIBUNIBILIUM_INCLUDE_DIRS}) -set(LIBTERMKEY_USE_STATIC ON) +option(LIBTERMKEY_USE_STATIC "Use static libtermkey" ON) find_package(LibTermkey REQUIRED) include_directories(SYSTEM ${LIBTERMEY_INCLUDE_DIRS}) -set(LIBVTERM_USE_STATIC ON) +option(LIBVTERM_USE_STATIC "Use static libvterm" ON) find_package(LibVterm REQUIRED) include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS}) diff --git a/clint-ignored-files.txt b/clint-ignored-files.txt index 7e0063aea0..e0e6b9f3d2 100644 --- a/clint-ignored-files.txt +++ b/clint-ignored-files.txt @@ -126,7 +126,6 @@ src/nvim/undo.h src/nvim/undo_defs.h src/nvim/version.c src/nvim/version.h -src/nvim/version_defs.h src/nvim/vim.h src/nvim/window.c src/nvim/window.h diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index 8f303bae2e..a4330a58de 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -15,6 +15,7 @@ endif() execute_process( COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE} + --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lpath=${BUILD_DIR}/?.lua ${TEST_PATH} WORKING_DIRECTORY ${WORKING_DIR} ERROR_VARIABLE err diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 1ee5c78adf..0d3ef62297 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -79,6 +79,12 @@ configure_file ( "${PROJECT_BINARY_DIR}/config/auto/config.h" ) +# generate version definitions +configure_file ( + "${PROJECT_SOURCE_DIR}/config/versiondef.h.in" + "${PROJECT_BINARY_DIR}/config/auto/versiondef.h" + ) + # generate pathdef.c find_program(WHOAMI_PROG whoami) find_program(HOSTNAME_PROG hostname) diff --git a/config/config.h.in b/config/config.h.in index 9e6f3d8e13..a3cd72b57c 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -1,11 +1,5 @@ -#define NVIM_VERSION_MAJOR @NVIM_VERSION_MAJOR@ -#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ -#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ -#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" -#define NVIM_VERSION_BUILD "@NVIM_VERSION_BUILD@" -#define NVIM_VERSION_COMMIT "@NVIM_VERSION_COMMIT@" -#define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@" -#define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@" +#ifndef AUTO_CONFIG_H +#define AUTO_CONFIG_H #cmakedefine DEBUG @@ -72,3 +66,5 @@ #define FEAT_BROWSE #define FEAT_CSCOPE #define FEAT_MOUSE + +#endif // AUTO_CONFIG_H diff --git a/config/versiondef.h.in b/config/versiondef.h.in new file mode 100644 index 0000000000..a177e599ba --- /dev/null +++ b/config/versiondef.h.in @@ -0,0 +1,13 @@ +#ifndef AUTO_VERSIONDEF_H +#define AUTO_VERSIONDEF_H + +#define NVIM_VERSION_MAJOR @NVIM_VERSION_MAJOR@ +#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ +#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ +#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" +#define NVIM_VERSION_BUILD "@NVIM_VERSION_BUILD@" +#define NVIM_VERSION_COMMIT "@NVIM_VERSION_COMMIT@" +#define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@" +#define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@" + +#endif // AUTO_VERSIONDEF_H diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index af4ef3e132..121b47167b 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -60,7 +60,7 @@ There are two ways to obtain API metadata: separate compilation step. Here's a simple way to get human-readable description of the API (requires -python and the `pyyaml`/`msgpack-python` pip packages): +Python and the `pyyaml`/`msgpack-python` pip packages): > nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' > api.yaml @@ -108,7 +108,7 @@ string 'hello world!' on the current nvim instance: nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS']) result = nvim.call(:vim_command, 'echo "hello world!"') < -A better way is to use the python REPL with the `neovim` package, where API +A better way is to use the Python REPL with the `neovim` package, where API functions can be called interactively: > >>> from neovim import attach @@ -119,7 +119,7 @@ functions can be called interactively: 4. Implementing new clients *msgpack-rpc-clients* Nvim is still in alpha, so there's no in-depth documentation explaining how to -properly implement a client library yet. The python client (the pip package +properly implement a client library yet. The Python client (the pip package "neovim") will always be up-to-date with the latest API changes, so its source code is the best documentation currently available. There are some guidelines however: diff --git a/runtime/doc/nvim_provider.txt b/runtime/doc/nvim_provider.txt index 2ab0510a3b..cea55a6656 100644 --- a/runtime/doc/nvim_provider.txt +++ b/runtime/doc/nvim_provider.txt @@ -10,10 +10,10 @@ First of all, this document is meant to be read by developers interested in contributing to the refactoring effort. If you are a normal user or plugin developer looking to learn about Nvim |msgpack-rpc| infrastructure for implementing plugins in other programming languages, see |external-plugin|. -For instructions on how to enable python plugins, see |nvim-python|. For +For instructions on how to enable Python plugins, see |nvim-python|. For clipboard, see |nvim-clipboard|. -Instead of doing everything by itself, Nvim aims to simplify it's own +Instead of doing everything by itself, Nvim aims to simplify its own maintenance by delegating as much work as possible to external systems. But some Vim components are too tightly coupled and in some cases the refactoring work necessary to swap in-house implementations by code that integrates to @@ -24,18 +24,18 @@ To understand why the provider infrastructure is useful, let us consider two examples of integration with external systems that are implemented in Vim and are now decoupled from Nvim core as providers: -The first example is clipboard integration: On the original Vim source code, +The first example is clipboard integration: in the original Vim source code, clipboard functions account for more than 1k lines of C source code (and that -is just on ui.c). All to peform two tasks that are now accomplished with +is just on ui.c), all to peform two tasks that are now accomplished with simple shell commands such as xclip or pbcopy/pbpaste. -The other example is python scripting support: Vim has three files dedicated -to embed the python interpreter: if_python.c, if_python3.c and if_py_both.h. -Together these files sum about 9.5k lines of C source code. On Nvim, python +The other example is Python scripting support: Vim has three files dedicated +to embed the Python interpreter: if_python.c, if_python3.c and if_py_both.h. +Together these files sum about 9.5k lines of C source code. On Nvim, Python scripting is performed by an external host process that is running 2k sloc -python program. +Python program. -In a perfect world, we would implement python and clipboard integration in +In a perfect world, we would implement Python and clipboard integration in pure vimscript and without touching the C code. Unfortunately we can't achieve these goals without severly compromising backwards compatibility with Vim. Thats where providers comes to rescue. @@ -61,15 +61,15 @@ The basic idea is that the provider#(name)#Call function should implement integration with an external system, because calling shell commands and |msgpack-rpc| clients (Nvim only) is easier to do in vimscript. -Now, back to the python example. Instead of modifying vimscript to allow for +Now, back to the Python example. Instead of modifying vimscript to allow for the definition of lowercase functions and commands (for the |:python|, |:pyfile|, and |:pydo| commands, and the |pyeval()| function), which would break backwards compatibility with Vim, we implemented the autoload/provider/python.vim script and the provider#python#Call function -that is only defined if an external python host is started successfully. +that is only defined if an external Python host is started successfully. -That works well with the `has('python')` expression (normally used by python -plugins) because if the python host isn't installed then the plugin will +That works well with the `has('python')` expression (normally used by Python +plugins) because if the Python host isn't installed then the plugin will "think" it is running in a Vim compiled without |+python| feature. ============================================================================== diff --git a/runtime/doc/nvim_python.txt b/runtime/doc/nvim_python.txt index 486c25edd0..4d80fe941f 100644 --- a/runtime/doc/nvim_python.txt +++ b/runtime/doc/nvim_python.txt @@ -12,22 +12,22 @@ Python plugins and scripting in Nvim *nvim-python* ============================================================================== 1. Introduction *nvim-python-intro* -Through an external python interpreter connected via |msgpack-rpc|, Nvim +Through an external Python interpreter connected via |msgpack-rpc|, Nvim offers some support for the legacy |python-vim| interface. For now only the old Vim 7.3 API is supported. ============================================================================== 2. Quickstart *nvim-python-quickstart* -If you just want to start using Vim python plugins with Nvim quickly, here's a +If you just want to start using Vim Python plugins with Nvim quickly, here's a simple tutorial: -- Make sure python 2.6 or 2.7 is available in your `$PATH` -- Install the `neovim` python package: +- Make sure Python 2.6 or 2.7 is available in your `$PATH` +- Install the `neovim` Python package: > $ pip install neovim < -Most python plugins created for Vim 7.3 should work after these steps. +Most Python plugins created for Vim 7.3 should work after these steps. ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/remote_plugin.txt b/runtime/doc/remote_plugin.txt index e5d1efcc96..7394cf7fe4 100644 --- a/runtime/doc/remote_plugin.txt +++ b/runtime/doc/remote_plugin.txt @@ -42,7 +42,7 @@ startup as fast as possible if many plugins/hosts are installed. 3. Example *remote-plugin-example* The best way to learn about remote plugins is with an example, so let's see -what a python plugin looks like. This plugin exports a command, a function and +what a Python plugin looks like. This plugin exports a command, a function and an autocmd. The plugin is called 'Limit', and all it does is limit the number of requests made to it. Here's the plugin source code: > @@ -81,7 +81,7 @@ of requests made to it. Here's the plugin source code: self.calls += 1 < -As can be seen, the plugin is implemented using pure python idioms (classes, +As can be seen, the plugin is implemented using pure Python idioms (classes, methods, and decorators), the translation between these language-specific idioms to vimscript occurs while the plugin manifest is being generated (see below). @@ -117,7 +117,7 @@ declared command, autocommand, or function is used for the first time. The manifest generation step is necessary to keep Nvim's startup fast in situations where a user has remote plugins with different hosts. For example, -say a user has three plugins, for python, java and .NET hosts respectively. If +say a user has three plugins, for Python, java and .NET hosts respectively. If we were to load all three plugins at startup, then three language runtimes would also be spawned which could take seconds! diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index fa25b68641..c4abcd77b1 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -70,6 +70,7 @@ #include "nvim/syntax.h" #include "nvim/ui.h" #include "nvim/undo.h" +#include "nvim/version.h" #include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/time.h" @@ -4033,8 +4034,6 @@ void do_modelines(int flags) --entered; } -#include "nvim/version_defs.h" /* for version number */ - /* * chk_modeline() - check a single line for a mode string * Return FAIL if an error encountered. diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9b4b4ce496..ae8e0d329f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -351,7 +351,6 @@ typedef enum { * The reason to use this table anyway is for very quick access to the * variables with the VV_ defines. */ -#include "nvim/version_defs.h" /* values for vv_flags: */ #define VV_COMPAT 1 /* compatible, also used without "v:" */ diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index afa397976b..e98032da5c 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -19,7 +19,6 @@ #include "nvim/vim.h" #include "nvim/ascii.h" -#include "nvim/version_defs.h" #include "nvim/ex_cmds.h" #include "nvim/buffer.h" #include "nvim/charset.h" @@ -64,6 +63,7 @@ #include "nvim/tempfile.h" #include "nvim/ui.h" #include "nvim/undo.h" +#include "nvim/version.h" #include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/shell.h" @@ -1708,7 +1708,7 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags) if (fp_out != NULL) { /* Write the info: */ fprintf(fp_out, _("# This viminfo file was generated by Nvim %s.\n"), - NVIM_VERSION_MEDIUM); + mediumVersion); fputs(_("# You may edit it if you're careful!\n\n"), fp_out); fputs(_("# Value of 'encoding' when this file was written\n"), fp_out); fprintf(fp_out, "*encoding=%s\n\n", p_enc); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index ffafe3cffb..44cb2d48a2 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -21,7 +21,7 @@ #ifdef HAVE_LOCALE_H # include <locale.h> #endif -#include "nvim/version_defs.h" +#include "nvim/version.h" #include "nvim/ex_cmds2.h" #include "nvim/buffer.h" #include "nvim/charset.h" diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 5d52774f40..b15db61f99 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -967,10 +967,6 @@ EXTERN int wild_menu_showing INIT(= 0); EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */ -/* these are in version.c */ -extern char *Version; -extern char *longVersion; - /* * Some file names are stored in pathdef.c, which is generated from the * Makefile to make their value depend on the Makefile. diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 0da5caf7cd..db81746d73 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -21,7 +21,6 @@ #ifdef HAVE_LOCALE_H # include <locale.h> #endif -#include "nvim/version_defs.h" #include "nvim/hardcopy.h" #include "nvim/buffer.h" #include "nvim/charset.h" @@ -42,6 +41,7 @@ #include "nvim/strings.h" #include "nvim/syntax.h" #include "nvim/ui.h" +#include "nvim/version.h" #include "nvim/tempfile.h" #include "nvim/os/os.h" #include "nvim/os/input.h" @@ -2440,7 +2440,7 @@ int mch_print_begin(prt_settings_T *psettings) STRCPY(buffer, "Unknown"); } prt_dsc_textline("For", buffer); - prt_dsc_textline("Creator", NVIM_VERSION_LONG); + prt_dsc_textline("Creator", longVersion); /* Note: to ensure Clean8bit I don't think we can use LC_TIME */ now = time(NULL); p_time = ctime(&now); diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 817fd08a9c..1339671c92 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -70,6 +70,7 @@ #include "nvim/spell.h" #include "nvim/strings.h" #include "nvim/ui.h" +#include "nvim/version.h" #include "nvim/tempfile.h" #include "nvim/undo.h" #include "nvim/window.h" diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index a836ab5680..04551355ae 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -19,7 +19,7 @@ #include "nvim/vim.h" #include "nvim/ascii.h" -#include "nvim/version_defs.h" +#include "nvim/version.h" #include "nvim/misc1.h" #include "nvim/charset.h" #include "nvim/cursor.h" diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h index e518ac67e5..28ae89ff77 100644 --- a/src/nvim/os/unix_defs.h +++ b/src/nvim/os/unix_defs.h @@ -1,7 +1,7 @@ #ifndef NVIM_OS_UNIX_DEFS_H #define NVIM_OS_UNIX_DEFS_H -#define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "$HOME"} +#define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "~"} #define TEMP_FILE_PATH_MAXLEN 256 #endif // NVIM_OS_UNIX_DEFS_H diff --git a/src/nvim/os_unix_defs.h b/src/nvim/os_unix_defs.h index 40230c7944..e5ab9fd4f7 100644 --- a/src/nvim/os_unix_defs.h +++ b/src/nvim/os_unix_defs.h @@ -101,9 +101,6 @@ #ifndef SYS_VIMRC_FILE # define SYS_VIMRC_FILE "$VIM/nvimrc" #endif -#ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM/ngvimrc" -#endif #ifndef DFLT_HELPFILE # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" #endif @@ -130,12 +127,12 @@ #endif #ifndef USR_EXRC_FILE -# define USR_EXRC_FILE "$HOME/.exrc" +# define USR_EXRC_FILE "~/.exrc" #endif #ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "$HOME/.nvimrc" +# define USR_VIMRC_FILE "~/.nvimrc" #endif @@ -143,18 +140,8 @@ # define USR_VIMRC_FILE2 "~/.nvim/nvimrc" #endif - -#ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "$HOME/.ngvimrc" -#endif - -#ifndef USR_GVIMRC_FILE2 -# define USR_GVIMRC_FILE2 "~/.nvim/ngvimrc" -#endif - - # ifndef VIMINFO_FILE -# define VIMINFO_FILE "$HOME/.nviminfo" +# define VIMINFO_FILE "~/.nviminfo" # endif #ifndef EXRC_FILE @@ -179,7 +166,7 @@ #endif #ifndef DFLT_VDIR -# define DFLT_VDIR "$HOME/.nvim/view" /* default for 'viewdir' */ +# define DFLT_VDIR "~/.nvim/view" // default for 'viewdir' #endif #define DFLT_ERRORFILE "errors.err" diff --git a/src/nvim/testdir/test100.in b/src/nvim/testdir/test100.in deleted file mode 100644 index bc1a55e4d3..0000000000 --- a/src/nvim/testdir/test100.in +++ /dev/null @@ -1,53 +0,0 @@ -Tests for 'undolevel' setting being global-local - -STARTTEST -:so small.vim -:set ul=5 -:fu! FillBuffer() - :for i in range(1,13) - :put=i - :exe "setg ul=" . &g:ul - :endfor -:endfu -:fu! UndoLevel() - :redir @a | setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |redir end - :$put a -:endfu -:new one -:0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' -:call FillBuffer() -:earlier 10 -:call UndoLevel() -:set ff=unix -:%w! test.out -:new two -:0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' -:setlocal ul=2 -:call FillBuffer() -:earlier 10 -:call UndoLevel() -:setlocal ul=10 -:call UndoLevel() -:set ff=unix -:%w >> test.out -:wincmd p -:redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end -:new three -:setglobal ul=50 -:1put ='global value should be changed to 50' -:2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' -:call UndoLevel() -:set ff=unix -:%w >> test.out -:"sleep 10 -:" -:" Testing 'lispwords' -:" -:setglobal lispwords=foo,bar,baz -:setlocal lispwords-=foo | setlocal lispwords+=quux -:redir >> test.out | echon "\nTesting 'lispwords' local value" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:setlocal lispwords< -:redir >> test.out | echon "\nTesting 'lispwords' value reset" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test100.ok b/src/nvim/testdir/test100.ok deleted file mode 100644 index 477106b8f2..0000000000 --- a/src/nvim/testdir/test100.ok +++ /dev/null @@ -1,51 +0,0 @@ -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) -1 -2 -3 -4 -5 -6 -7 - - - undolevels=5 global - undolevels=-123456 local -TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 - - - undolevels=5 global - undolevels=2 local - - undolevels=5 global - undolevels=10 local - -global value shouldn't be changed and still be 5! -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) - undolevels=5 global - undolevels=-123456 local - -global value should be changed to 50 -THREE: expecting global undolevels: 50, local undolevels: -123456 (default) - - undolevels=50 global - undolevels=-123456 local - -Testing 'lispwords' local value - lispwords=foo,bar,baz - lispwords=bar,baz,quux -bar,baz,quux - -Testing 'lispwords' value reset - lispwords=foo,bar,baz - lispwords=foo,bar,baz -foo,bar,baz diff --git a/src/nvim/testdir/test103.in b/src/nvim/testdir/test103.in deleted file mode 100644 index 7c7591e3b9..0000000000 --- a/src/nvim/testdir/test103.in +++ /dev/null @@ -1,37 +0,0 @@ -Test for visual mode not being reset causing E315 error. -STARTTEST -:so small.vim -:enew -:let g:msg="Everything's fine." -:function! TriggerTheProblem() -: " At this point there is no visual selection because :call reset it. -: " Let's restore the selection: -: normal gv -: '<,'>del _ -: try -: exe "normal \<Esc>" -: catch /^Vim\%((\a\+)\)\=:E315/ -: echom 'Snap! E315 error!' -: let g:msg='Snap! E315 error!' -: endtry -:endfunction -:enew -:setl buftype=nofile -:call append(line('$'), 'Delete this line.') -:" -:" -:" NOTE: this has to be done by a call to a function because executing :del the -:" ex-way will require the colon operator which resets the visual mode thus -:" preventing the problem: -:" -GV:call TriggerTheProblem() -:%del _ -:call append(line('$'), g:msg) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test103.ok b/src/nvim/testdir/test103.ok deleted file mode 100644 index 9ea6dd6eea..0000000000 --- a/src/nvim/testdir/test103.ok +++ /dev/null @@ -1,2 +0,0 @@ - -Everything's fine. diff --git a/src/nvim/testdir/test15.in b/src/nvim/testdir/test15.in deleted file mode 100644 index 60d8717278..0000000000 --- a/src/nvim/testdir/test15.in +++ /dev/null @@ -1,135 +0,0 @@ -Tests for :right on text with embedded TAB. -Also test formatting a paragraph. -Also test undo after ":%s" and formatting. - -STARTTEST -:so small.vim -:set tw=65 - -:/^\s*test for :left/,/^\s*test for :center/ left -:/^\s*test for :center/,/^\s*test for :right/ center -:/^\s*test for :right/,/^xxx/-1 right -:set fo+=tcroql tw=72 -/xxxxxxxx$ -0gq6kk -:" undo/redo here to make the next undo only work on the following changes -u -:map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq -/^aa -ggu -:?test for :left?,$w! test.out -:qa! -ENDTEST - - test for :left - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf -asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx -xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx -xx xxxxxxx. xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx -> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/nvim/testdir/test15.ok b/src/nvim/testdir/test15.ok deleted file mode 100644 index bc09f5e7db..0000000000 --- a/src/nvim/testdir/test15.ok +++ /dev/null @@ -1,111 +0,0 @@ -test for :left -a a -fa a -dfa a -sdfa a -asdfa a -xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf - asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. -xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx -> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/nvim/testdir/test77.in b/src/nvim/testdir/test77.in deleted file mode 100644 index 0dbc4fcbaf..0000000000 --- a/src/nvim/testdir/test77.in +++ /dev/null @@ -1,30 +0,0 @@ -Inserts 2 million lines with consecutive integers starting from 1 -(essentially, the output of GNU's seq 1 2000000), writes them to Xtest -and writes its cksum to test.out. - -We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess -up the lines the checksum would differ. - -cksum is part of POSIX and so should be available on most Unixes. -If it isn't available then the test will be skipped. - -STARTTEST -:so small.vim -:if !executable("cksum") -: e! test.ok -: w! test.out -: qa! -:endif -:set fileformat=unix undolevels=-1 -ggdG -:let i = 1 -:while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile -ggdd -:w! Xtest -:r !cksum Xtest -:s/\s/ /g -:set fileformat& -:.w! test.out -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test77.ok b/src/nvim/testdir/test77.ok deleted file mode 100644 index 11f148c73f..0000000000 --- a/src/nvim/testdir/test77.ok +++ /dev/null @@ -1 +0,0 @@ -3678979763 14888896 Xtest diff --git a/src/nvim/testdir/test84.in b/src/nvim/testdir/test84.in deleted file mode 100644 index 25482db54c..0000000000 --- a/src/nvim/testdir/test84.in +++ /dev/null @@ -1,35 +0,0 @@ -Tests for curswant not changing when setting an option - -STARTTEST -:so small.vim -:/^start target options$/+1,/^end target options$/-1 yank -:let target_option_names = split(@0) -:function TestCurswant(option_name) -: normal! ggf8j -: let curswant_before = winsaveview().curswant -: execute 'let' '&'.a:option_name '=' '&'.a:option_name -: let curswant_after = winsaveview().curswant -: return [a:option_name, curswant_before, curswant_after] -:endfunction -: -:new -:put =['1234567890', '12345'] -:1 delete _ -:let result = [] -:for option_name in target_option_names -: call add(result, TestCurswant(option_name)) -:endfor -: -:new -:put =map(copy(result), 'join(v:val, '' '')') -:1 delete _ -:write test.out -: -:qall! -ENDTEST - -start target options - tabstop - timeoutlen - ttimeoutlen -end target options diff --git a/src/nvim/testdir/test84.ok b/src/nvim/testdir/test84.ok deleted file mode 100644 index 8b8e4ee824..0000000000 --- a/src/nvim/testdir/test84.ok +++ /dev/null @@ -1,3 +0,0 @@ -tabstop 7 4 -timeoutlen 7 7 -ttimeoutlen 7 7 diff --git a/src/nvim/testdir/test90.in b/src/nvim/testdir/test90.in deleted file mode 100644 index 3c0d8c030c..0000000000 --- a/src/nvim/testdir/test90.in +++ /dev/null @@ -1,53 +0,0 @@ -Tests for sha256() function. vim: set ft=vim et ts=2 sw=2 : - -STARTTEST -:so small.vim -:if !exists('*sha256') - e! test.ok - wq! test.out -:endif -:" -:let testcase='test for empty string: ' -:if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 1 char: ' -:if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 3 chars: ' -:if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains meta char: ' -:if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains non-ascii char: ' -:if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -" -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/nvim/testdir/test90.ok b/src/nvim/testdir/test90.ok deleted file mode 100644 index 9a8e7fe961..0000000000 --- a/src/nvim/testdir/test90.ok +++ /dev/null @@ -1,6 +0,0 @@ -start: -test for empty string: ok -test for 1 char: ok -test for 3 chars: ok -test for contains meta char: ok -test for contains non-ascii char: ok diff --git a/src/nvim/testdir/test91.in b/src/nvim/testdir/test91.in deleted file mode 100644 index b66776b1e4..0000000000 --- a/src/nvim/testdir/test91.in +++ /dev/null @@ -1,112 +0,0 @@ -Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). -vim: set ft=vim : - -STARTTEST -:so small.vim -:so mbyte.vim -:" -:" Test for getbufvar() -:" Use strings to test for memory leaks. -:let b:var_num = '1234' -:let def_num = '5678' -:$put =string(getbufvar(1, 'var_num')) -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:unlet b:var_num -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:$put =string(getbufvar(9, '')) -:$put =string(getbufvar(9, '', def_num)) -:unlet def_num -:$put =string(getbufvar(1, '&autoindent')) -:$put =string(getbufvar(1, '&autoindent', 1)) -:" -:" Open new window with forced option values -:set fileformats=unix,dos -:new ++ff=dos ++bin ++enc=iso-8859-2 -:let otherff = getbufvar(bufnr('%'), '&fileformat') -:let otherbin = getbufvar(bufnr('%'), '&bin') -:let otherfenc = getbufvar(bufnr('%'), '&fenc') -:close -:$put =otherff -:$put =string(otherbin) -:$put =otherfenc -:unlet otherff otherbin otherfenc -:" test for getwinvar() -:let w:var_str = "Dance" -:let def_str = "Chance" -:$put =string(getwinvar(1, 'var_str')) -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:unlet w:var_str -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:$put =string(getwinvar(9, '')) -:$put =string(getwinvar(9, '', def_str)) -:$put =string(getwinvar(1, '&nu')) -:$put =string(getwinvar(1, '&nu', 1)) -:unlet def_str -:" -:" test for gettabvar() -:tabnew -:tabnew -:let t:var_list = [1, 2, 3] -:let t:other = 777 -:let def_list = [4, 5, 6, 7] -:tabrewind -:$put =string(gettabvar(3, 'var_list')) -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(3, '')) -:$put =string(gettabvar(3, '', def_list)) -:tablast -:unlet t:var_list -:tabrewind -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(9, '')) -:$put =string(gettabvar(9, '', def_list)) -:$put =string(gettabvar(3, '&nu')) -:$put =string(gettabvar(3, '&nu', def_list)) -:unlet def_list -:tabonly -:" -:" test for gettabwinvar() -:tabnew -:tabnew -:tabprev -:split -:split -:wincmd w -:vert split -:wincmd w -:let w:var_dict = {'dict': 'tabwin'} -:let def_dict = {'dict2': 'newval'} -:wincmd b -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict')) -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:tabnext -:3wincmd w -:unlet w:var_dict -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:$put =string(gettabwinvar(2, 9, '')) -:$put =string(gettabwinvar(2, 9, '', def_dict)) -:$put =string(gettabwinvar(9, 3, '')) -:$put =string(gettabwinvar(9, 3, '', def_dict)) -:unlet def_dict -:$put =string(gettabwinvar(2, 3, '&nux')) -:$put =string(gettabwinvar(2, 3, '&nux', 1)) -:tabonly -:" -:/^start/,$wq! test.out -ENDTEST - -start: diff --git a/src/nvim/testdir/test91.ok b/src/nvim/testdir/test91.ok deleted file mode 100644 index 809952b69d..0000000000 --- a/src/nvim/testdir/test91.ok +++ /dev/null @@ -1,48 +0,0 @@ -start: -'1234' -'1234' -{'var_num': '1234'} -{'var_num': '1234'} -'5678' -{} -{} -'' -'5678' -0 -0 -dos -1 -iso-8859-2 -'Dance' -'Dance' -{'var_str': 'Dance'} -{'var_str': 'Dance'} -'Chance' -{} -{} -'' -'Chance' -0 -0 -[1, 2, 3] -[1, 2, 3] -{'var_list': [1, 2, 3], 'other': 777} -{'var_list': [1, 2, 3], 'other': 777} -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -{'dict': 'tabwin'} -{'dict': 'tabwin'} -{'var_dict': {'dict': 'tabwin'}} -{'var_dict': {'dict': 'tabwin'}} -{'dict2': 'newval'} -{} -{} -'' -{'dict2': 'newval'} -'' -{'dict2': 'newval'} -'' -1 diff --git a/src/nvim/testdir/test95.in b/src/nvim/testdir/test95.in deleted file mode 100644 index 221b550487..0000000000 --- a/src/nvim/testdir/test95.in +++ /dev/null @@ -1,140 +0,0 @@ -Test for regexp patterns with multi-byte support, using utf-8. -See test64 for the non-multi-byte tests. - -A pattern that gives the expected result produces OK, so that we know it was -actually tried. - -STARTTEST -:so small.vim -:so mbyte.vim -:set encoding=utf-8 nomore -:" tl is a List of Lists with: -:" 2: test auto/old/new 0: test auto/old 1: test auto/new -:" regexp pattern -:" text to test the pattern on -:" expected match (optional) -:" expected submatch 1 (optional) -:" expected submatch 2 (optional) -:" etc. -:" When there is no match use only the first two items. -:let tl = [] - -:"""" Multi-byte character tests. -:call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) -:call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes -:call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) -:call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) -:call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) - -:" this is not a normal "i" but 0xec -:call add(tl, [2, '\p\+', 'ìa', 'ìa']) -:call add(tl, [2, '\p*', 'aあ', 'aあ']) - -:"""" Test recognition of some character classes -:call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) -:call add(tl, [2, '\f\+', '&*fname ', 'fname']) - -:"""" Test composing character matching -:call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) -:call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) -:call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) -:call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) -:call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "a", "ca\u0300t"]) -:call add(tl, [2, "ca", "ca\u0300t"]) -:call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) -:call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) -:call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) -:call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) - - -:"""" Test \Z -:call add(tl, [2, 'ú\Z', 'x']) -:call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) -:call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) -:call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) -:call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) -:call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) -:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) -:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) -:call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) -:call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) -:call add(tl, [2, "\u05b9\\Z", "xyz"]) -:call add(tl, [2, "\\Z\u05b9", "xyz"]) -:call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) -:call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) -:call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) -:call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) - -:"""" Combining different tests and features -:call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) - -:"""" Run the tests - -:" -:for t in tl -: let re = t[0] -: let pat = t[1] -: let text = t[2] -: let matchidx = 3 -: for engine in [0, 1, 2] -: if engine == 2 && re == 0 || engine == 1 && re == 1 -: continue -: endif -: let ®expengine = engine -: try -: let l = matchlist(text, pat) -: catch -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' -: endtry -:" check the match itself -: if len(l) == 0 && len(t) > matchidx -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' -: elseif len(l) > 0 && len(t) == matchidx -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' -: elseif len(t) > matchidx && l[0] != t[matchidx] -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' -: else -: $put ='OK ' . engine . ' - ' . pat -: endif -: if len(l) > 0 -:" check all the nine submatches -: for i in range(1, 9) -: if len(t) <= matchidx + i -: let e = '' -: else -: let e = t[matchidx + i] -: endif -: if l[i] != e -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' -: endif -: endfor -: unlet i -: endif -: endfor -:endfor -:unlet t tl e l - -:" check that 'ambiwidth' does not change the meaning of \p -:set regexpengine=1 ambiwidth=single -:$put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') -:set regexpengine=1 ambiwidth=double -:$put ='eng 1 ambi double: ' . match(\"\u00EC\", '\p') -:set regexpengine=2 ambiwidth=single -:$put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') -:set regexpengine=2 ambiwidth=double -:$put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') - -:/\%#=1^Results/,$wq! test.out -ENDTEST - -Results of test95: diff --git a/src/nvim/testdir/test95.ok b/src/nvim/testdir/test95.ok deleted file mode 100644 index 6762994c12..0000000000 --- a/src/nvim/testdir/test95.ok +++ /dev/null @@ -1,140 +0,0 @@ -Results of test95: -OK 0 - [[:alpha:][=a=]]\+ -OK 1 - [[:alpha:][=a=]]\+ -OK 2 - [[:alpha:][=a=]]\+ -OK 0 - [[=a=]]\+ -OK 1 - [[=a=]]\+ -OK 2 - [[=a=]]\+ -OK 0 - [^ม ]\+ -OK 1 - [^ม ]\+ -OK 2 - [^ม ]\+ -OK 0 - [^ ]\+ -OK 1 - [^ ]\+ -OK 2 - [^ ]\+ -OK 0 - [ม[:alpha:][=a=]]\+ -OK 1 - [ม[:alpha:][=a=]]\+ -OK 2 - [ม[:alpha:][=a=]]\+ -OK 0 - \p\+ -OK 1 - \p\+ -OK 2 - \p\+ -OK 0 - \p* -OK 1 - \p* -OK 2 - \p* -OK 0 - \i\+ -OK 1 - \i\+ -OK 2 - \i\+ -OK 0 - \f\+ -OK 1 - \f\+ -OK 2 - \f\+ -OK 0 - .ม -OK 1 - .ม -OK 2 - .ม -OK 0 - .ม่ -OK 1 - .ม่ -OK 2 - .ม่ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹֻ -OK 1 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - ֹֻ -OK 1 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - a -OK 1 - a -OK 2 - a -OK 0 - ca -OK 1 - ca -OK 2 - ca -OK 0 - à -OK 1 - à -OK 2 - à -OK 0 - a\%C -OK 1 - a\%C -OK 2 - a\%C -OK 0 - ca\%C -OK 1 - ca\%C -OK 2 - ca\%C -OK 0 - ca\%Ct -OK 1 - ca\%Ct -OK 2 - ca\%Ct -OK 0 - ú\Z -OK 1 - ú\Z -OK 2 - ú\Z -OK 0 - יהוה\Z -OK 1 - יהוה\Z -OK 2 - יהוה\Z -OK 0 - יְהוָה\Z -OK 1 - יְהוָה\Z -OK 2 - יְהוָה\Z -OK 0 - יהוה\Z -OK 1 - יהוה\Z -OK 2 - יהוה\Z -OK 0 - יְהוָה\Z -OK 1 - יְהוָה\Z -OK 2 - יְהוָה\Z -OK 0 - יְ\Z -OK 1 - יְ\Z -OK 2 - יְ\Z -OK 0 - קֹx\Z -OK 1 - קֹx\Z -OK 2 - קֹx\Z -OK 0 - קֹx\Z -OK 1 - קֹx\Z -OK 2 - קֹx\Z -OK 0 - קx\Z -OK 1 - קx\Z -OK 2 - קx\Z -OK 0 - קx\Z -OK 1 - קx\Z -OK 2 - קx\Z -OK 0 - ֹ\Z -OK 1 - ֹ\Z -OK 2 - ֹ\Z -OK 0 - \Zֹ -OK 1 - \Zֹ -OK 2 - \Zֹ -OK 0 - ֹ\Z -OK 1 - ֹ\Z -OK 2 - ֹ\Z -OK 0 - \Zֹ -OK 1 - \Zֹ -OK 2 - \Zֹ -OK 0 - ֹ\+\Z -OK 2 - ֹ\+\Z -OK 0 - \Zֹ\+ -OK 2 - \Zֹ\+ -OK 0 - [^[=a=]]\+ -OK 1 - [^[=a=]]\+ -OK 2 - [^[=a=]]\+ -eng 1 ambi single: 0 -eng 1 ambi double: 0 -eng 2 ambi single: 0 -eng 2 ambi double: 0 diff --git a/src/nvim/testdir/test98.in b/src/nvim/testdir/test98.in deleted file mode 100644 index 83ccba09e9..0000000000 --- a/src/nvim/testdir/test98.in +++ /dev/null @@ -1,43 +0,0 @@ -Test for 'scrollbind' causing an unexpected scroll of one of the windows. -STARTTEST -:so small.vim -:" We don't want the status line to cause problems: -:set laststatus=0 -:let g:totalLines = &lines * 20 -:let middle = g:totalLines / 2 -:wincmd n -:wincmd o -:for i in range(1, g:totalLines) -: call setline(i, 'LINE ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:aboveleft vert new -:for i in range(1, g:totalLines) -: call setline(i, 'line ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:" Execute the following two command at once to reproduce the problem. -:setl scb | wincmd p -:setl scb -:wincmd w -:let topLineLeft = line('w0') -:wincmd p -:let topLineRight = line('w0') -:setl noscrollbind -:wincmd p -:setl noscrollbind -:q! -:%del _ -:call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test98.ok b/src/nvim/testdir/test98.ok deleted file mode 100644 index 356ddd8eac..0000000000 --- a/src/nvim/testdir/test98.ok +++ /dev/null @@ -1 +0,0 @@ -Difference between the top lines (left - right): 0 diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in deleted file mode 100644 index 23b3098786..0000000000 --- a/src/nvim/testdir/test_listlbr_utf8.in +++ /dev/null @@ -1,53 +0,0 @@ -Test for linebreak and list option in utf-8 mode - -STARTTEST -:so small.vim -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif -:set wildchar=^E -:so mbyte.vim -:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" -:norm! zt -:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap -:fu! ScreenChar(width) -: let c='' -: for j in range(1,4) -: for i in range(1,a:width) -: let c.=nr2char(screenchar(j, i)) -: endfor -: let c.="\n" -: endfor -: return c -:endfu -:fu! DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line -: wincmd p -:endfu -:let g:test ="Test 1: set linebreak + set list + fancy listchars" -:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 2: set nolinebreak list" -:set list nolinebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 3: set linebreak nolist" -:$put =\"\t*mask = nil;\" -:$ -:norm! zt -:set nolist linebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok deleted file mode 100644 index 634cf3906d..0000000000 --- a/src/nvim/testdir/test_listlbr_utf8.ok +++ /dev/null @@ -1,21 +0,0 @@ - - abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP - -Test 1: set linebreak + set list + fancy listchars -▕———abcdef -+hijklmn▕——— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ - -Test 2: set nolinebreak list -▕———abcdef hijklmn▕— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ -¶ - *mask = nil; - -Test 3: set linebreak nolist - *mask = nil; -~ -~ -~ diff --git a/src/nvim/testdir/test_qf_title.in b/src/nvim/testdir/test_qf_title.in deleted file mode 100644 index fce0c260e3..0000000000 --- a/src/nvim/testdir/test_qf_title.in +++ /dev/null @@ -1,18 +0,0 @@ -Tests for quickfix window's title vim: set ft=vim : - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif -:set efm=%E%f:%l:%c:%m -:cgetexpr ['file:1:1:message'] -:let qflist=getqflist() -:call setqflist(qflist, 'r') -:copen -:let g:quickfix_title=w:quickfix_title -:wincmd p -:$put =g:quickfix_title -:/^Results/,$w test.out -:qa! -ENDTEST - -Results of test_qf_title: diff --git a/src/nvim/testdir/test_qf_title.ok b/src/nvim/testdir/test_qf_title.ok deleted file mode 100644 index 4ebdbeff3b..0000000000 --- a/src/nvim/testdir/test_qf_title.ok +++ /dev/null @@ -1,2 +0,0 @@ -Results of test_qf_title: -:setqflist() diff --git a/src/nvim/version.c b/src/nvim/version.c index 8357de9f46..474dbf73f8 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -18,10 +18,24 @@ #include "nvim/misc2.h" #include "nvim/screen.h" #include "nvim/strings.h" -#include "nvim/version_defs.h" + +// version info generated by the build system +#include "auto/versiondef.h" + +#define STR_(x) #x +#define STR(x) STR_(x) + +// for the startup-screen ( ":intro" command ) +#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR) + +// for the ":version" command and "nvim --version" +#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE NVIM_VERSION_BUILD + char *Version = VIM_VERSION_SHORT; -char *longVersion = NVIM_VERSION_LONG " (compiled " __DATE__ " " __TIME__ ")"; +char *longVersion = NVIM_VERSION_LONG; +char *longVersionWithDate = NVIM_VERSION_LONG " (compiled " __DATE__ " " __TIME__ ")"; +char *mediumVersion = NVIM_VERSION_MEDIUM; char *version_commit = "Commit: " NVIM_VERSION_COMMIT; char *version_buildtype = "Build type: " NVIM_VERSION_BUILD_TYPE; char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS; @@ -885,7 +899,7 @@ void list_version(void) { // When adding features here, don't forget to update the list of // internal variables in eval.c! - MSG(longVersion); + MSG(longVersionWithDate); MSG(version_commit); MSG(version_buildtype); MSG(version_cflags); diff --git a/src/nvim/version.h b/src/nvim/version.h index d1b19a062f..c1881250f1 100644 --- a/src/nvim/version.h +++ b/src/nvim/version.h @@ -1,6 +1,23 @@ #ifndef NVIM_VERSION_H #define NVIM_VERSION_H +// defined in version.c +extern char* Version; +extern char* mediumVersion; +extern char* longVersion; + +// +// Vim version number, name, etc. Patchlevel is defined in version.c. +// +#define VIM_VERSION_MAJOR 7 +#define VIM_VERSION_MINOR 4 +#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR) + +// used for the runtime directory name +#define VIM_VERSION_NODOT "vim74" +// swap file compatibility (max. length is 6 chars) +#define VIM_VERSION_SHORT "7.4" + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "version.h.generated.h" #endif diff --git a/src/nvim/version_defs.h b/src/nvim/version_defs.h deleted file mode 100644 index 0ba6143632..0000000000 --- a/src/nvim/version_defs.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef NVIM_VERSION_DEFS_H -#define NVIM_VERSION_DEFS_H - -// VIM - Vi IMproved by Bram Moolenaar -// -// Do ":help uganda" in Vim to read copying and usage conditions. -// Do ":help credits" in Vim to see a list of people who contributed. - -#define STR_(x) #x -#define STR(x) STR_(x) - -// -// Nvim version identifiers -// -#ifndef NVIM_VERSION_MAJOR -#define NVIM_VERSION_MAJOR 0 -#endif -#ifndef NVIM_VERSION_MINOR -#define NVIM_VERSION_MINOR 0 -#endif -#ifndef NVIM_VERSION_PATCH -#define NVIM_VERSION_PATCH 0 -#endif -#ifndef NVIM_VERSION_PRERELEASE -#define NVIM_VERSION_PRERELEASE "?" -#endif -#ifndef NVIM_VERSION_BUILD -#define NVIM_VERSION_BUILD "?" -#endif -#ifndef NVIM_VERSION_COMMIT -#define NVIM_VERSION_COMMIT "?" -#endif -#ifndef NVIM_VERSION_CFLAGS -#define NVIM_VERSION_CFLAGS "?" -#endif -#ifndef NVIM_VERSION_BUILD_TYPE -#define NVIM_VERSION_BUILD_TYPE "?" -#endif -// for the startup-screen -#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR) -// for the ":version" command and "nvim -h" -#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE NVIM_VERSION_BUILD - -// -// Vim version number, name, etc. Patchlevel is defined in version.c. -// -#define VIM_VERSION_MAJOR 7 -#define VIM_VERSION_MINOR 4 -#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR) - -// used for the runtime directory name -#define VIM_VERSION_NODOT "vim74" -// swap file compatibility (max. length is 6 chars) -#define VIM_VERSION_SHORT "7.4" - -#endif // NVIM_VERSION_DEFS_H diff --git a/test/functional/legacy/005_bufleave_delete_buffer.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua index e8459ad4a7..e6989a6674 100644 --- a/test/functional/legacy/005_bufleave_delete_buffer.lua +++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua @@ -38,18 +38,15 @@ describe('test5', function() -- Write current file contents. execute('?start?,$yank A') - -- Delete alternate buffer. - execute('bwipe test.out') - execute('au bufleave test5.in bwipe') - -- Delete current buffer, get an empty one. execute('bwipe!') + -- Append an extra line to the output register. feed('ithis is another test line<esc>:yank A<cr>') -- Output results execute('%d') execute('0put a') - execute('1d | $d') + execute('$d') -- Assert buffer contents. expect([[ diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua new file mode 100644 index 0000000000..e71f9d1c90 --- /dev/null +++ b/test/functional/legacy/015_alignment_spec.lua @@ -0,0 +1,258 @@ +-- Tests for :right on text with embedded TAB. +-- Also test formatting a paragraph. +-- Also test undo after ":%s" and formatting. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('alignment', function() + setup(clear) + + it('is working', function() + insert([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx + xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx + xx xxxxxxx. xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx + > xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + + execute('set tw=65') + + feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]]) + feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]]) + feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]]) + + execute('set fo+=tcroql tw=72') + + feed('/xxxxxxxx$<cr>') + feed('0gq6kk<cr>') + + -- Undo/redo here to make the next undo only work on the following changes. + feed('u<cr>') + execute('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq') + execute('/^aa') + feed('ggu<cr>') + + -- Assert buffer contents. + expect([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. + xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx + > xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + end) +end) diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/051_highlight_spec.lua index 19eb4104cd..3d0375312d 100644 --- a/test/functional/legacy/051_highlight_spec.lua +++ b/test/functional/legacy/051_highlight_spec.lua @@ -28,7 +28,7 @@ describe(':highlight', function() gui=bold | guifg=Blue | Directory xxx ctermfg=4 | - -- More --^ | + -- More --^ | ]]) feed('q') wait() -- wait until we're back to normal diff --git a/test/functional/legacy/077_mf_hash_grow_spec.lua b/test/functional/legacy/077_mf_hash_grow_spec.lua new file mode 100644 index 0000000000..01d916ef04 --- /dev/null +++ b/test/functional/legacy/077_mf_hash_grow_spec.lua @@ -0,0 +1,45 @@ +-- Inserts 2 million lines with consecutive integers starting from 1 +-- (essentially, the output of GNU's seq 1 2000000), writes them to Xtest +-- and calculates its cksum. +-- We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess +-- up the lines the checksum would differ. +-- cksum is part of POSIX and so should be available on most Unixes. +-- If it isn't available then the test will be skipped. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('mf_hash_grow()', function() + setup(clear) + + -- Check to see if cksum exists, otherwise skip the test + if os.execute('which cksum 2>&1 > /dev/null') ~= 0 then + pending("was not tested because cksum was not found") + else + it('is working', function() + execute('set fileformat=unix undolevels=-1') + + -- Fill the buffer with numbers 1 - 2000000 + execute('let i = 1') + execute('while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile') + + -- Delete empty first line, save to Xtest, and clear buffer + feed('ggdd<cr>') + execute('w! Xtest') + feed('ggdG<cr>') + + -- Calculate the cksum of Xtest and delete first line + execute('r !cksum Xtest') + feed('ggdd<cr>') + + -- Assert correct output of cksum. + expect([[ + 3678979763 14888896 Xtest]]) + end) + end + + teardown(function() + os.remove('Xtest') + end) +end) diff --git a/test/functional/legacy/084_curswant_spec.lua b/test/functional/legacy/084_curswant_spec.lua new file mode 100644 index 0000000000..55df5d3e73 --- /dev/null +++ b/test/functional/legacy/084_curswant_spec.lua @@ -0,0 +1,48 @@ +-- Tests for curswant not changing when setting an option. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('curswant', function() + setup(clear) + + it('is working', function() + insert([[ + start target options + tabstop + timeoutlen + ttimeoutlen + end target options]]) + + source([[ + /^start target options$/+1,/^end target options$/-1 yank + let target_option_names = split(@0) + function TestCurswant(option_name) + normal! ggf8j + let curswant_before = winsaveview().curswant + execute 'let' '&'.a:option_name '=' '&'.a:option_name + let curswant_after = winsaveview().curswant + return [a:option_name, curswant_before, curswant_after] + endfunction + + new + put =['1234567890', '12345'] + 1 delete _ + let result = [] + for option_name in target_option_names + call add(result, TestCurswant(option_name)) + endfor + + new + put =map(copy(result), 'join(v:val, '' '')') + 1 delete _ + ]]) + + -- Assert buffer contents. + expect([[ + tabstop 7 4 + timeoutlen 7 7 + ttimeoutlen 7 7]]) + end) +end) diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua new file mode 100644 index 0000000000..35fbd5752e --- /dev/null +++ b/test/functional/legacy/090_sha256_spec.lua @@ -0,0 +1,64 @@ +-- Tests for sha256() function. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('sha256()', function() + setup(clear) + + it('is working', function() + insert("start:") + + source([[ + let testcase='test for empty string: ' + if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 1 char: ' + if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 3 chars: ' + if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains meta char: ' + if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains non-ascii char: ' + if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + ]]) + + -- Assert buffer contents. + expect([[ + start: + test for empty string: ok + test for 1 char: ok + test for 3 chars: ok + test for contains meta char: ok + test for contains non-ascii char: ok]]) + end) +end) diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua new file mode 100644 index 0000000000..bb9c32b84f --- /dev/null +++ b/test/functional/legacy/091_context_variables_spec.lua @@ -0,0 +1,176 @@ +-- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('context variables', function() + setup(clear) + + it('is working', function() + insert("start:") + + -- Test for getbufvar(). + -- Use strings to test for memory leaks. + source([[ + let b:var_num = '1234' + let def_num = '5678' + $put =string(getbufvar(1, 'var_num')) + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + unlet b:var_num + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + $put =string(getbufvar(9, '')) + $put =string(getbufvar(9, '', def_num)) + unlet def_num + $put =string(getbufvar(1, '&autoindent')) + $put =string(getbufvar(1, '&autoindent', 1)) + ]]) + + -- Open new window with forced option values. + source([[ + set fileformats=unix,dos + new ++ff=dos ++bin ++enc=iso-8859-2 + let otherff = getbufvar(bufnr('%'), '&fileformat') + let otherbin = getbufvar(bufnr('%'), '&bin') + let otherfenc = getbufvar(bufnr('%'), '&fenc') + close + $put =otherff + $put =string(otherbin) + $put =otherfenc + unlet otherff otherbin otherfenc + ]]) + + -- Test for getwinvar(). + source([[ + let w:var_str = "Dance" + let def_str = "Chance" + $put =string(getwinvar(1, 'var_str')) + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + unlet w:var_str + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + $put =string(getwinvar(9, '')) + $put =string(getwinvar(9, '', def_str)) + $put =string(getwinvar(1, '&nu')) + $put =string(getwinvar(1, '&nu', 1)) + unlet def_str + ]]) + + -- Test for gettabvar(). + source([[ + tabnew + tabnew + let t:var_list = [1, 2, 3] + let t:other = 777 + let def_list = [4, 5, 6, 7] + tabrewind + $put =string(gettabvar(3, 'var_list')) + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(3, '')) + $put =string(gettabvar(3, '', def_list)) + tablast + unlet t:var_list + tabrewind + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(9, '')) + $put =string(gettabvar(9, '', def_list)) + $put =string(gettabvar(3, '&nu')) + $put =string(gettabvar(3, '&nu', def_list)) + unlet def_list + tabonly + ]]) + + -- Test for gettabwinvar(). + source([[ + tabnew + tabnew + tabprev + split + split + wincmd w + vert split + wincmd w + let w:var_dict = {'dict': 'tabwin'} + let def_dict = {'dict2': 'newval'} + wincmd b + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict')) + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + tabnext + 3wincmd w + unlet w:var_dict + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + $put =string(gettabwinvar(2, 9, '')) + $put =string(gettabwinvar(2, 9, '', def_dict)) + $put =string(gettabwinvar(9, 3, '')) + $put =string(gettabwinvar(9, 3, '', def_dict)) + unlet def_dict + $put =string(gettabwinvar(2, 3, '&nux')) + $put =string(gettabwinvar(2, 3, '&nux', 1)) + tabonly + ]]) + + -- Assert buffer contents. + expect([[ + start: + '1234' + '1234' + {'var_num': '1234'} + {'var_num': '1234'} + '5678' + {} + {} + '' + '5678' + 0 + 0 + dos + 1 + iso-8859-2 + 'Dance' + 'Dance' + {'var_str': 'Dance'} + {'var_str': 'Dance'} + 'Chance' + {} + {} + '' + 'Chance' + 0 + 0 + [1, 2, 3] + [1, 2, 3] + {'var_list': [1, 2, 3], 'other': 777} + {'var_list': [1, 2, 3], 'other': 777} + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + {'dict': 'tabwin'} + {'dict': 'tabwin'} + {'var_dict': {'dict': 'tabwin'}} + {'var_dict': {'dict': 'tabwin'}} + {'dict2': 'newval'} + {} + {} + '' + {'dict2': 'newval'} + '' + {'dict2': 'newval'} + '' + 1]]) + end) +end) diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua new file mode 100644 index 0000000000..a72fb669d2 --- /dev/null +++ b/test/functional/legacy/095_regexp_multibyte_spec.lua @@ -0,0 +1,270 @@ +-- Test for regexp patterns with multi-byte support, using utf-8. +-- See test64 for the non-multi-byte tests. +-- A pattern that gives the expected result produces OK, so that we know it was +-- actually tried. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('regex with multi-byte', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test95:]]) + + source([=[ + set encoding=utf-8 nomore + let tl = [] + + call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) + call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes + call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) + call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) + call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) + + call add(tl, [2, '\p\+', 'ìa', 'ìa']) + call add(tl, [2, '\p*', 'aあ', 'aあ']) + + call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) + call add(tl, [2, '\f\+', '&*fname ', 'fname']) + + call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) + call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) + call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "a", "ca\u0300t"]) + call add(tl, [2, "ca", "ca\u0300t"]) + call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) + call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) + + call add(tl, [2, 'ú\Z', 'x']) + call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "\u05b9\\Z", "xyz"]) + call add(tl, [2, "\\Z\u05b9", "xyz"]) + call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) + call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) + call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + + call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) + + for t in tl + let re = t[0] + let pat = t[1] + let text = t[2] + let matchidx = 3 + for engine in [0, 1, 2] + if engine == 2 && re == 0 || engine == 1 && re == 1 + continue + endif + let ®expengine = engine + try + let l = matchlist(text, pat) + catch + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' + endtry + if len(l) == 0 && len(t) > matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' + elseif len(l) > 0 && len(t) == matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' + elseif len(t) > matchidx && l[0] != t[matchidx] + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' + else + $put ='OK ' . engine . ' - ' . pat + endif + if len(l) > 0 + for i in range(1, 9) + if len(t) <= matchidx + i + let e = '' + else + let e = t[matchidx + i] + endif + if l[i] != e + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' + endif + endfor + unlet i + endif + endfor + endfor + unlet t tl e l + + set regexpengine=1 ambiwidth=single + $put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=1 ambiwidth=double + $put ='eng 1 ambi double: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=single + $put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=double + $put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') + ]=]) + + -- Assert buffer contents. + expect([=[ + Results of test95: + OK 0 - [[:alpha:][=a=]]\+ + OK 1 - [[:alpha:][=a=]]\+ + OK 2 - [[:alpha:][=a=]]\+ + OK 0 - [[=a=]]\+ + OK 1 - [[=a=]]\+ + OK 2 - [[=a=]]\+ + OK 0 - [^ม ]\+ + OK 1 - [^ม ]\+ + OK 2 - [^ม ]\+ + OK 0 - [^ ]\+ + OK 1 - [^ ]\+ + OK 2 - [^ ]\+ + OK 0 - [ม[:alpha:][=a=]]\+ + OK 1 - [ม[:alpha:][=a=]]\+ + OK 2 - [ม[:alpha:][=a=]]\+ + OK 0 - \p\+ + OK 1 - \p\+ + OK 2 - \p\+ + OK 0 - \p* + OK 1 - \p* + OK 2 - \p* + OK 0 - \i\+ + OK 1 - \i\+ + OK 2 - \i\+ + OK 0 - \f\+ + OK 1 - \f\+ + OK 2 - \f\+ + OK 0 - .ม + OK 1 - .ม + OK 2 - .ม + OK 0 - .ม่ + OK 1 - .ม่ + OK 2 - .ม่ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - a + OK 1 - a + OK 2 - a + OK 0 - ca + OK 1 - ca + OK 2 - ca + OK 0 - à + OK 1 - à + OK 2 - à + OK 0 - a\%C + OK 1 - a\%C + OK 2 - a\%C + OK 0 - ca\%C + OK 1 - ca\%C + OK 2 - ca\%C + OK 0 - ca\%Ct + OK 1 - ca\%Ct + OK 2 - ca\%Ct + OK 0 - ú\Z + OK 1 - ú\Z + OK 2 - ú\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יְ\Z + OK 1 - יְ\Z + OK 2 - יְ\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\+\Z + OK 2 - ֹ\+\Z + OK 0 - \Zֹ\+ + OK 2 - \Zֹ\+ + OK 0 - [^[=a=]]\+ + OK 1 - [^[=a=]]\+ + OK 2 - [^[=a=]]\+ + eng 1 ambi single: 0 + eng 1 ambi double: 0 + eng 2 ambi single: 0 + eng 2 ambi double: 0]=]) + end) +end) diff --git a/test/functional/legacy/098_scrollbind_spec.lua b/test/functional/legacy/098_scrollbind_spec.lua new file mode 100644 index 0000000000..7b2059e38b --- /dev/null +++ b/test/functional/legacy/098_scrollbind_spec.lua @@ -0,0 +1,48 @@ +-- Test for 'scrollbind' causing an unexpected scroll of one of the windows. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('scrollbind', function() + setup(clear) + + it('is working', function() + source([[ + set laststatus=0 + let g:totalLines = &lines * 20 + let middle = g:totalLines / 2 + wincmd n + wincmd o + for i in range(1, g:totalLines) + call setline(i, 'LINE ' . i) + endfor + exe string(middle) + normal zt + normal M + aboveleft vert new + for i in range(1, g:totalLines) + call setline(i, 'line ' . i) + endfor + exe string(middle) + normal zt + normal M + setl scb | wincmd p + setl scb + wincmd w + let topLineLeft = line('w0') + wincmd p + let topLineRight = line('w0') + setl noscrollbind + wincmd p + setl noscrollbind + q! + %del _ + call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) + brewind + ]]) + + -- Assert buffer contents. + expect("Difference between the top lines (left - right): 0") + end) +end) diff --git a/test/functional/legacy/100_undo_level_spec.lua b/test/functional/legacy/100_undo_level_spec.lua new file mode 100644 index 0000000000..9143d9e540 --- /dev/null +++ b/test/functional/legacy/100_undo_level_spec.lua @@ -0,0 +1,142 @@ +-- Tests for 'undolevel' setting being global-local + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('undolevel', function() + setup(clear) + + it('is working', function() + source([[ + set ul=5 + fu! FillBuffer() + for i in range(1,13) + put=i + exe "setg ul=" . &g:ul + endfor + endfu + fu! UndoLevel() + redir @z + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + redir end + $put z + endfu + + 0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + call FillBuffer() + setlocal undolevels< + earlier 10 + call UndoLevel() + set ff=unix + %yank A + %delete + + 0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' + setlocal ul=2 + call FillBuffer() + earlier 10 + call UndoLevel() + setlocal ul=10 + call UndoLevel() + set ff=unix + %yank A + %delete + setlocal undolevels< + redir @A + echo "global value shouldn't be changed and still be 5!" + echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + echo "" + redir end + + setglobal ul=50 + 1put ='global value should be changed to 50' + 2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' + call UndoLevel() + set ff=unix + %yank A + %delete + setglobal lispwords=foo,bar,baz + setlocal lispwords-=foo + setlocal lispwords+=quux + redir @A + echo "Testing 'lispwords' local value" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + echo '' + redir end + setlocal lispwords< + redir @A + echo "Testing 'lispwords' value reset" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + redir end + + 0put a + $d + ]]) + + -- Assert buffer contents. + expect([[ + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + undolevels=5 global + undolevels=-123456 local + TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + undolevels=5 global + undolevels=2 local + + undolevels=5 global + undolevels=10 local + + global value shouldn't be changed and still be 5! + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + undolevels=5 global + undolevels=-123456 local + + global value should be changed to 50 + THREE: expecting global undolevels: 50, local undolevels: -123456 (default) + + undolevels=50 global + undolevels=-123456 local + + Testing 'lispwords' local value + lispwords=foo,bar,baz + lispwords=bar,baz,quux + bar,baz,quux + + Testing 'lispwords' value reset + lispwords=foo,bar,baz + lispwords=foo,bar,baz + foo,bar,baz]]) + end) +end) diff --git a/test/functional/legacy/103_visual_mode_reset_spec.lua b/test/functional/legacy/103_visual_mode_reset_spec.lua new file mode 100644 index 0000000000..6b2f3bc1b6 --- /dev/null +++ b/test/functional/legacy/103_visual_mode_reset_spec.lua @@ -0,0 +1,47 @@ +-- Test for visual mode not being reset causing E315 error. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('E315 error', function() + setup(clear) + + it('is working', function() + -- At this point there is no visual selection because :call reset it. + -- Let's restore the selection: + source([[ + let g:msg="Everything's fine." + function! TriggerTheProblem() + normal gv + '<,'>del _ + try + exe "normal \<Esc>" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry + endfunction + enew + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + ]]) + + -- NOTE: this has to be done by a call to a function because executing + -- :del the ex-way will require the colon operator which resets the + -- visual mode thus preventing the problem: + feed('GV:call TriggerTheProblem()<cr>') + + source([[ + %del _ + call append(line('$'), g:msg) + brewind + ]]) + + -- Assert buffer contents. + expect([[ + + Everything's fine.]]) + end) +end) diff --git a/test/functional/legacy/104_let_assignment.lua b/test/functional/legacy/104_let_assignment_spec.lua index a2431da835..a2431da835 100644 --- a/test/functional/legacy/104_let_assignment.lua +++ b/test/functional/legacy/104_let_assignment_spec.lua 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 ffc2208d6e..f6ea7e5a6c 100644 --- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua +++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua @@ -43,7 +43,7 @@ describe('107', function() start: | [1, '1 '] | [50, '50 '] | - ^59, '59 '] | + ^[59, '59 '] | ~ | ~ | ~ | diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua new file mode 100644 index 0000000000..303596976f --- /dev/null +++ b/test/functional/legacy/listlbr_utf8_spec.lua @@ -0,0 +1,79 @@ +-- Test for linebreak and list option in utf-8 mode + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('linebreak', function() + setup(clear) + + it('is working', function() + source([[ + set wildchar=^E + 10new + vsp + vert resize 20 + put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" + norm! zt + set ts=4 sw=4 sts=4 linebreak sbr=+ wrap + fu! ScreenChar(width) + let c='' + for j in range(1,4) + for i in range(1,a:width) + let c.=nr2char(screenchar(j, i)) + endfor + let c.="\n" + endfor + return c + endfu + fu! DoRecordScreen() + wincmd l + $put =printf(\"\n%s\", g:test) + $put =g:line + wincmd p + endfu + let g:test ="Test 1: set linebreak + set list + fancy listchars" + exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 2: set nolinebreak list" + set list nolinebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 3: set linebreak nolist" + $put =\"\t*mask = nil;\" + $ + norm! zt + set nolist linebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + ]]) + + -- Assert buffer contents. + expect([[ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + + Test 1: set linebreak + set list + fancy listchars + ▕———abcdef + +hijklmn▕——— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + + Test 2: set nolinebreak list + ▕———abcdef hijklmn▕— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + ¶ + *mask = nil; + + Test 3: set linebreak nolist + *mask = nil; + ~ + ~ + ~ ]]) + end) +end) diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua new file mode 100644 index 0000000000..aa005117be --- /dev/null +++ b/test/functional/legacy/qf_title_spec.lua @@ -0,0 +1,30 @@ +-- Tests for quickfix window's title + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('qf_title', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test_qf_title:]]) + + source([[ + set efm=%E%f:%l:%c:%m + cgetexpr ['file:1:1:message'] + let qflist=getqflist() + call setqflist(qflist, 'r') + copen + let g:quickfix_title=w:quickfix_title + wincmd p + $put =g:quickfix_title + ]]) + + -- Assert buffer contents. + expect([[ + Results of test_qf_title: + :setqflist()]]) + end) +end) diff --git a/test/functional/preload.lua b/test/functional/preload.lua new file mode 100644 index 0000000000..5f34f7fa6e --- /dev/null +++ b/test/functional/preload.lua @@ -0,0 +1,5 @@ +-- 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 ffi = require('ffi') +local helpers = require('test.functional.helpers') diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index 75e9de6aa9..2742e23e00 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -60,7 +60,7 @@ describe('system()', function() it('`echo` and waits for its return', function() feed(':call system("echo")<cr>') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -93,11 +93,11 @@ describe('system()', function() ~ | ~ | ~ | - ^call system("yes") | + ^:call system("yes") | ]]) feed('<c-c>') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -226,7 +226,7 @@ describe('systemlist()', function() it('`echo` and waits for its return', function() feed(':call systemlist("echo")<cr>') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -259,11 +259,11 @@ describe('systemlist()', function() ~ | ~ | ~ | - ^call systemlist("yes | xargs") | + ^:call systemlist("yes | xargs") | ]]) feed('<c-c>') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 52ab3cb5bf..33a53ef201 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -54,7 +54,7 @@ describe('Default highlight groups', function() }) execute('sp', 'vsp', 'vsp') screen:expect([[ - ^ {2:|} {2:|} | + ^ {2:|} {2:|} | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | @@ -79,7 +79,7 @@ describe('Default highlight groups', function() ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | {2:[No Name] [No Name] [No Name] }| - ^ | + ^ | ~ | ~ | ~ | @@ -92,7 +92,7 @@ describe('Default highlight groups', function() -- (upstream vim has the same behavior) feed('<c-w>k<c-w>l') screen:expect([[ - {2:|}^ {2:|} | + {2:|}^ {2:|} | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | @@ -109,7 +109,7 @@ describe('Default highlight groups', function() ]]) feed('<c-w>l') screen:expect([[ - {2:|} {2:|}^ | + {2:|} {2:|}^ | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | @@ -126,7 +126,7 @@ describe('Default highlight groups', function() ]]) feed('<c-w>h<c-w>h') screen:expect([[ - ^ {2:|} {2:|} | + ^ {2:|} {2:|} | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | ~ {2:|}~ {2:|}~ | @@ -146,7 +146,7 @@ describe('Default highlight groups', function() it('insert mode text', function() feed('i') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -165,7 +165,7 @@ describe('Default highlight groups', function() it('end of file markers', function() screen:expect([[ - ^ | + ^ | {1:~ }| {1:~ }| {1:~ }| @@ -198,7 +198,7 @@ describe('Default highlight groups', function() ~ | :ls | 1 %a "[No Name]" line 1 | - {1:Press ENTER or type command to continue}^ | + {1:Press ENTER or type command to continue}^ | ]], {[1] = {bold = true, foreground = hlgroup_colors.Question}}) feed('<cr>') -- skip the "Press ENTER..." state or tests will hang end) diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 296487fc9c..f1973f60ba 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -28,7 +28,7 @@ describe('Mouse input', function() screen:expect([[ testing | mouse | - support and selectio^ | + support and selectio^n | ~ | | ]]) @@ -42,14 +42,14 @@ describe('Mouse input', function() feed('<LeftMouse><2,1>') screen:expect([[ testing | - mo^se | + mo^use | support and selection | ~ | | ]]) feed('<LeftMouse><0,0>') screen:expect([[ - ^esting | + ^testing | mouse | support and selection | ~ | @@ -62,7 +62,7 @@ describe('Mouse input', function() feed('<LeftMouse><2,1>') screen:expect([[ testing | - mo^se | + mo^use | support and selection | ~ | | @@ -70,7 +70,7 @@ describe('Mouse input', function() feed('<LeftDrag><4,1>') screen:expect([[ testing | - mo{1:us}^ | + mo{1:us}^e | support and selection | ~ | {2:-- VISUAL --} | @@ -79,13 +79,13 @@ describe('Mouse input', function() screen:expect([[ testing | mo{1:use } | - {1:su}^port and selection | + {1:su}^pport and selection | ~ | {2:-- VISUAL --} | ]]) feed('<LeftDrag><0,0>') screen:expect([[ - ^{1:esting } | + ^t{1:esting } | {1:mou}se | support and selection | ~ | @@ -98,7 +98,7 @@ describe('Mouse input', function() screen:expect([[ testing | mouse | - {1:suppor}^ and selection | + {1:suppor}^t and selection | ~ | {2:-- VISUAL --} | ]]) @@ -109,7 +109,7 @@ describe('Mouse input', function() screen:expect([[ testing | mouse | - {1:su}^{1:port and selection } | + {1:su}^p{1:port and selection } | ~ | {2:-- VISUAL LINE --} | ]]) @@ -120,7 +120,7 @@ describe('Mouse input', function() screen:expect([[ testing | mouse | - su^port and selection | + su^pport and selection | ~ | {2:-- VISUAL BLOCK --} | ]]) @@ -129,7 +129,7 @@ describe('Mouse input', function() it('right click extends visual selection to the clicked location', function() feed('<LeftMouse><0,0>') screen:expect([[ - ^esting | + ^testing | mouse | support and selection | ~ | @@ -139,7 +139,7 @@ describe('Mouse input', function() screen:expect([[ {1:testing } | {1:mouse } | - {1:su}^port and selection | + {1:su}^pport and selection | ~ | {2:-- VISUAL --} | ]]) @@ -153,7 +153,7 @@ describe('Mouse input', function() E426: tag not found: test| ing | Press ENTER or type comma| - nd to continue^ | + nd to continue^ | ]],nil,true) feed('<cr>') end) @@ -179,7 +179,7 @@ describe('Mouse input', function() to |to | test |test | mouse scrolling |mouse scrolling | - ^ | | + ^ | | ~ |~ | [No Name] [+] [No Name] [+] | to | @@ -193,7 +193,7 @@ describe('Mouse input', function() feed('<MouseUp><0,0>') screen:expect([[ mouse scrolling |lines | - ^ |to | + ^ |to | ~ |test | ~ |mouse scrolling | ~ | | @@ -210,7 +210,7 @@ describe('Mouse input', function() feed('<MouseDown><27,0>') screen:expect([[ mouse scrolling |text | - ^ |with | + ^ |with | ~ |many | ~ |lines | ~ |to | @@ -227,7 +227,7 @@ describe('Mouse input', function() feed('<MouseDown><27,7><MouseDown>') screen:expect([[ mouse scrolling |text | - ^ |with | + ^ |with | ~ |many | ~ |lines | ~ |to | diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 71703cc112..585037466e 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -418,9 +418,8 @@ function Screen:_row_repr(row, attr_ids, attr_ignore) end if self._rows[self._cursor.row] == row and self._cursor.col == i then table.insert(rv, '^') - else - table.insert(rv, row[i].text) end + table.insert(rv, row[i].text) end if current_attr_id then table.insert(rv, '}') diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index 06edf44a7c..366a0af453 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -85,7 +85,7 @@ describe('Screen', function() it('horizontal', function() execute('sp') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -106,7 +106,7 @@ describe('Screen', function() execute('sp') execute('resize 8') screen:expect([[ - ^ | + ^ | ~ | ~ | ~ | @@ -126,7 +126,7 @@ describe('Screen', function() it('horizontal and vertical', function() execute('sp', 'vsp', 'vsp') screen:expect([[ - ^ | | | + ^ | | | ~ |~ |~ | ~ |~ |~ | ~ |~ |~ | @@ -143,7 +143,7 @@ describe('Screen', function() ]]) insert('hello') screen:expect([[ - hell^ |hello |hello | + hell^o |hello |hello | ~ |~ |~ | ~ |~ |~ | ~ |~ |~ | @@ -169,7 +169,7 @@ describe('Screen', function() execute('sp', 'vsp', 'vsp') insert('hello') screen:expect([[ - hell^ |hello |hello | + hell^o |hello |hello | ~ |~ |~ | ~ |~ |~ | ~ |~ |~ | @@ -189,7 +189,7 @@ describe('Screen', function() feed('h') screen:expect([[ 4+ [No Name] + [No Name] X| - hell^2 | + hell^o2 | ~ | ~ | ~ | @@ -206,7 +206,7 @@ describe('Screen', function() execute('tabprevious') screen:expect([[ 4+ [No Name] + [No Name] X| - hell^ |hello |hello | + hell^o |hello |hello | ~ |~ |~ | ~ |~ |~ | ~ |~ |~ | @@ -229,7 +229,7 @@ describe('Screen', function() screen:expect([[ line 1 | line 2 | - ^ | + ^ | ~ | ~ | ~ | @@ -262,7 +262,7 @@ describe('Screen', function() ~ | ~ | ~ | - :ls^ | + :ls^ | ]]) end) @@ -282,7 +282,7 @@ describe('Screen', function() ~ | :ls | 1 %a "[No Name]" line 1 | - Press ENTER or type command to continue^ | + Press ENTER or type command to continue^ | ]]) feed('<cr>') -- skip the "Press ENTER..." state or tests will hang end) @@ -312,7 +312,7 @@ describe('Screen', function() in |in |in | split |split |split | windows |windows |windows | - ^ | | | + ^ | | | [No Name] [+] [No Name] [+] [No Name] [+] | clearing | in | @@ -327,7 +327,7 @@ describe('Screen', function() it('only affects the current scroll region', function() feed('6k') screen:expect([[ - ^crolling |and |and | + ^scrolling |and |and | and |clearing |clearing | clearing |in |in | in |split |split | @@ -349,7 +349,7 @@ describe('Screen', function() clearing |in |in | in |split |split | split |windows |windows | - windows |^ | | + windows |^ | | [No Name] [+] [No Name] [+] <Name] [+] | clearing | in | @@ -361,7 +361,7 @@ describe('Screen', function() ]]) feed('gg') screen:expect([[ - scrolling |^nserting |and | + scrolling |^Inserting |and | and |text |clearing | clearing |with |in | in |many |split | @@ -383,7 +383,7 @@ describe('Screen', function() clearing |lines |in | in |to |split | split |test |windows | - windows |^crolling | | + windows |^scrolling | | [No Name] [+] [No Name] [+] <Name] [+] | clearing | in | @@ -400,7 +400,7 @@ describe('Screen', function() clearing |test |in | in |scrolling |split | split |and |windows | - windows |^learing | | + windows |^clearing | | [No Name] [+] [No Name] [+] <Name] [+] | clearing | in | @@ -412,7 +412,7 @@ describe('Screen', function() ]]) feed('5k') screen:expect([[ - scrolling |^ines |and | + scrolling |^lines |and | and |to |clearing | clearing |test |in | in |scrolling |split | @@ -429,7 +429,7 @@ describe('Screen', function() ]]) feed('k') screen:expect([[ - scrolling |^any |and | + scrolling |^many |and | and |lines |clearing | clearing |to |in | in |test |split | @@ -455,7 +455,7 @@ describe('Screen', function() it('rebuilds the whole screen', function() screen:expect([[ - resize^ | + resize^ | ~ | ~ | ~ | @@ -466,13 +466,13 @@ describe('Screen', function() it('has minimum width/height values', function() screen:try_resize(1, 1) screen:expect([[ - -- INS^RT --| + -- INS^ERT --| | ]]) feed('<esc>:ls') screen:expect([[ resize | - :ls^ | + :ls^ | ]]) end) end) diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index a7a4172440..c32a7b9381 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -28,7 +28,7 @@ describe('Signs', function() >!a | b | >>c | - ^ | + ^ | ~ | ~ | ~ | diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index ee2f8b15f8..dd2bc84cfa 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -25,7 +25,7 @@ describe("'wildmode'", function() ~ | ~ | define jump list > | - :sign define^ | + :sign define^ | ]]) end) end) diff --git a/test/unit/preload.lua b/test/unit/preload.lua new file mode 100644 index 0000000000..d8ec2c3943 --- /dev/null +++ b/test/unit/preload.lua @@ -0,0 +1,7 @@ +-- 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 ffi = require('ffi') +local helpers = require('test.unit.helpers') +local lfs = require('lfs') +local preprocess = require('test.unit.preprocess') diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index b9e4d0e539..2eb1bee765 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -1,6 +1,9 @@ # This is not meant to be included by the top-level. cmake_minimum_required (VERSION 2.8.7) project(NEOVIM_DEPS) + +# Point CMake at any custom modules we may ship +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr") set(DEPS_BIN_DIR "${CMAKE_BINARY_DIR}/usr/bin") @@ -67,234 +70,36 @@ set(LIBUNIBILIUM_SHA256 bec06ea90128b46f28b91b8b52b861dede5f4ede0a92f05178b3c7bc set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/8c0cb7108cc63218ea19aa898968eede19e19603.tar.gz) set(LIBTERMKEY_SHA256 21846369081e6c9a0b615f4b3889c4cb809321c5ccc6e6c1640eb138f1590072) -set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/dd92e5ba5b0907571df938ac7601b1641f05ed16.tar.gz) -set(LIBVTERM_SHA256 850780dfef9e576c06b0e31ea1356da17da2bb4fd9e065a23ac50c88db2b0630) +set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/1b745d29d45623aa8d22a7b9288c7b0e331c7088.tar.gz) +set(LIBVTERM_SHA256 3fc75908256c0d158d6c2a32d39f34e86bfd26364f5404b7d9c03bb70cdc3611) if(USE_BUNDLED_LIBUNIBILIUM) - ExternalProject_Add(libunibilium - PREFIX ${DEPS_BUILD_DIR} - URL ${LIBUNIBILIUM_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libunibilium - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libunibilium - -DURL=${LIBUNIBILIUM_URL} - -DEXPECTED_SHA256=${LIBUNIBILIUM_SHA256} - -DTARGET=libunibilium - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} - PREFIX=${DEPS_INSTALL_DIR} - CFLAGS=-fPIC - INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install) - list(APPEND THIRD_PARTY_DEPS libunibilium) + include(BuildLibunibilium) endif() if(USE_BUNDLED_LIBTERMKEY) - ExternalProject_Add(libtermkey - PREFIX ${DEPS_BUILD_DIR} - URL ${LIBTERMKEY_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtermkey - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtermkey - -DURL=${LIBTERMKEY_URL} - -DEXPECTED_SHA256=${LIBTERMKEY_SHA256} - -DTARGET=libtermkey - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND "" - INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} - PREFIX=${DEPS_INSTALL_DIR} - PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig - CFLAGS=-fPIC - install) - list(APPEND THIRD_PARTY_DEPS libtermkey) - add_dependencies(libtermkey libunibilium) + include(BuildLibtermkey) endif() if(USE_BUNDLED_LIBVTERM) - ExternalProject_Add(libvterm - PREFIX ${DEPS_BUILD_DIR} - URL ${LIBVTERM_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libvterm - -DURL=${LIBVTERM_URL} - -DEXPECTED_SHA256=${LIBVTERM_SHA256} - -DTARGET=libvterm - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND "" - INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} - PREFIX=${DEPS_INSTALL_DIR} - CFLAGS=-fPIC - install) - list(APPEND THIRD_PARTY_DEPS libvterm) + include(BuildLibvterm) endif() - if(USE_BUNDLED_LIBUV) - ExternalProject_Add(libuv - PREFIX ${DEPS_BUILD_DIR} - URL ${LIBUV_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libuv - -DURL=${LIBUV_URL} - -DEXPECTED_SHA256=${LIBUV_SHA256} - -DTARGET=libuv - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND sh ${DEPS_BUILD_DIR}/src/libuv/autogen.sh && - ${DEPS_BUILD_DIR}/src/libuv/configure --with-pic --disable-shared - --prefix=${DEPS_INSTALL_DIR} --libdir=${DEPS_INSTALL_DIR}/lib - CC=${DEPS_C_COMPILER} - INSTALL_COMMAND ${MAKE_PRG} install) - list(APPEND THIRD_PARTY_DEPS libuv) + include(BuildLibuv) endif() if(USE_BUNDLED_MSGPACK) - ExternalProject_Add(msgpack - PREFIX ${DEPS_BUILD_DIR} - URL ${MSGPACK_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/msgpack - -DURL=${MSGPACK_URL} - -DEXPECTED_SHA256=${MSGPACK_SHA256} - -DTARGET=msgpack - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND cmake ${DEPS_BUILD_DIR}/src/msgpack - -DMSGPACK_ENABLE_CXX=OFF - -DMSGPACK_BUILD_TESTS=OFF - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC" - BUILD_COMMAND ${CMAKE_COMMAND} --build . - INSTALL_COMMAND ${CMAKE_COMMAND} - -DREMOVE_FILE_GLOB=${DEPS_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}msgpack*${CMAKE_SHARED_LIBRARY_SUFFIX}* - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InstallMsgpack.cmake) - list(APPEND THIRD_PARTY_DEPS msgpack) + include(BuildMsgpack) endif() if(USE_BUNDLED_LUAJIT) - ExternalProject_Add(luajit - PREFIX ${DEPS_BUILD_DIR} - URL ${LUAJIT_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luajit - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luajit - -DURL=${LUAJIT_URL} - -DEXPECTED_SHA256=${LUAJIT_SHA256} - -DTARGET=luajit - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND "" - INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} - PREFIX=${DEPS_INSTALL_DIR} - CFLAGS=-fPIC - CFLAGS+=-DLUAJIT_DISABLE_JIT - CFLAGS+=-DLUA_USE_APICHECK - CFLAGS+=-DLUA_USE_ASSERT - CCDEBUG+=-g - BUILDMODE=static - install) - list(APPEND THIRD_PARTY_DEPS luajit) + include(BuildLuajit) endif() if(USE_BUNDLED_LUAROCKS) - if(USE_BUNDLED_LUAJIT) - list(APPEND LUAROCKS_OPTS - --with-lua=${DEPS_INSTALL_DIR} - --with-lua-include=${DEPS_INSTALL_DIR}/include/luajit-2.0) - endif() - ExternalProject_Add(luarocks - PREFIX ${DEPS_BUILD_DIR} - URL ${LUAROCKS_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luarocks - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luarocks - -DURL=${LUAROCKS_URL} - -DEXPECTED_SHA256=${LUAROCKS_SHA256} - -DTARGET=luarocks - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure - --prefix=${DEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS} - --lua-suffix=jit - BUILD_COMMAND "" - INSTALL_COMMAND ${MAKE_PRG} bootstrap) - list(APPEND THIRD_PARTY_DEPS luarocks) - if(USE_BUNDLED_LUAJIT) - add_dependencies(luarocks luajit) - endif() - - add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build lua_cliargs 2.3-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build luafilesystem 1.6.3-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build dkjson 2.5-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build say 1.2-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build luassert 1.7.2-0 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build ansicolors 1.0.2-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build penlight 1.0.0-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build mediator_lua 1.1-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - COMMAND touch ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps - DEPENDS luarocks) - add_custom_target(stable-busted-deps - DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps) - - add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build busted 2.0.rc4 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - DEPENDS stable-busted-deps) - add_custom_target(busted - DEPENDS ${DEPS_BIN_DIR}/busted) - - # lua-messagepack doesn't depend on busted, but luarocks is unhappy to have - # two instances running in parallel. So we depend on busted to force it to - # be serialized. - add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build lua-messagepack CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - DEPENDS busted) - add_custom_target(lua-messagepack - DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack) - - # Like before, depend on lua-messagepack to ensure serialization of install - # commands - add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lpeg - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build lpeg CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} - DEPENDS lua-messagepack) - add_custom_target(lpeg - DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lpeg) - - add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client - COMMAND ${DEPS_BIN_DIR}/luarocks - ARGS build https://raw.githubusercontent.com/neovim/lua-client/8cc5b6090ac61cd0bba53ba984f15792fbb64573/nvim-client-0.0.1-11.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR} - DEPENDS lpeg libuv) - add_custom_target(nvim-client - DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client) - - list(APPEND THIRD_PARTY_DEPS stable-busted-deps busted lua-messagepack lpeg nvim-client) + include(BuildLuarocks) endif() add_custom_target(third-party ALL diff --git a/third-party/cmake/BuildLibtermkey.cmake b/third-party/cmake/BuildLibtermkey.cmake new file mode 100644 index 0000000000..43ecc52538 --- /dev/null +++ b/third-party/cmake/BuildLibtermkey.cmake @@ -0,0 +1,22 @@ + +ExternalProject_Add(libtermkey + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBTERMKEY_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtermkey + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtermkey + -DURL=${LIBTERMKEY_URL} + -DEXPECTED_SHA256=${LIBTERMKEY_SHA256} + -DTARGET=libtermkey + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig + CFLAGS=-fPIC + install) +list(APPEND THIRD_PARTY_DEPS libtermkey) +add_dependencies(libtermkey libunibilium) diff --git a/third-party/cmake/BuildLibunibilium.cmake b/third-party/cmake/BuildLibunibilium.cmake new file mode 100644 index 0000000000..3fb212b2a0 --- /dev/null +++ b/third-party/cmake/BuildLibunibilium.cmake @@ -0,0 +1,20 @@ + +ExternalProject_Add(libunibilium + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBUNIBILIUM_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libunibilium + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libunibilium + -DURL=${LIBUNIBILIUM_URL} + -DEXPECTED_SHA256=${LIBUNIBILIUM_SHA256} + -DTARGET=libunibilium + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + CFLAGS=-fPIC + INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install) +list(APPEND THIRD_PARTY_DEPS libunibilium) + diff --git a/third-party/cmake/BuildLibuv.cmake b/third-party/cmake/BuildLibuv.cmake new file mode 100644 index 0000000000..df5517a17e --- /dev/null +++ b/third-party/cmake/BuildLibuv.cmake @@ -0,0 +1,19 @@ + +ExternalProject_Add(libuv + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBUV_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libuv + -DURL=${LIBUV_URL} + -DEXPECTED_SHA256=${LIBUV_SHA256} + -DTARGET=libuv + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND sh ${DEPS_BUILD_DIR}/src/libuv/autogen.sh && + ${DEPS_BUILD_DIR}/src/libuv/configure --with-pic --disable-shared + --prefix=${DEPS_INSTALL_DIR} --libdir=${DEPS_INSTALL_DIR}/lib + CC=${DEPS_C_COMPILER} + INSTALL_COMMAND ${MAKE_PRG} install) +list(APPEND THIRD_PARTY_DEPS libuv) + diff --git a/third-party/cmake/BuildLibvterm.cmake b/third-party/cmake/BuildLibvterm.cmake new file mode 100644 index 0000000000..aca48046bc --- /dev/null +++ b/third-party/cmake/BuildLibvterm.cmake @@ -0,0 +1,21 @@ + +ExternalProject_Add(libvterm + PREFIX ${DEPS_BUILD_DIR} + URL ${LIBVTERM_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libvterm + -DURL=${LIBVTERM_URL} + -DEXPECTED_SHA256=${LIBVTERM_SHA256} + -DTARGET=libvterm + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + CFLAGS=-fPIC + install) +list(APPEND THIRD_PARTY_DEPS libvterm) + diff --git a/third-party/cmake/BuildLuajit.cmake b/third-party/cmake/BuildLuajit.cmake new file mode 100644 index 0000000000..b2548bd182 --- /dev/null +++ b/third-party/cmake/BuildLuajit.cmake @@ -0,0 +1,26 @@ + +ExternalProject_Add(luajit + PREFIX ${DEPS_BUILD_DIR} + URL ${LUAJIT_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luajit + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luajit + -DURL=${LUAJIT_URL} + -DEXPECTED_SHA256=${LUAJIT_SHA256} + -DTARGET=luajit + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER} + PREFIX=${DEPS_INSTALL_DIR} + CFLAGS=-fPIC + CFLAGS+=-DLUAJIT_DISABLE_JIT + CFLAGS+=-DLUA_USE_APICHECK + CFLAGS+=-DLUA_USE_ASSERT + CCDEBUG+=-g + BUILDMODE=static + install) +list(APPEND THIRD_PARTY_DEPS luajit) + diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake new file mode 100644 index 0000000000..796e324297 --- /dev/null +++ b/third-party/cmake/BuildLuarocks.cmake @@ -0,0 +1,86 @@ + +if(USE_BUNDLED_LUAJIT) + list(APPEND LUAROCKS_OPTS + --with-lua=${DEPS_INSTALL_DIR} + --with-lua-include=${DEPS_INSTALL_DIR}/include/luajit-2.0) +endif() +ExternalProject_Add(luarocks + PREFIX ${DEPS_BUILD_DIR} + URL ${LUAROCKS_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luarocks + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luarocks + -DURL=${LUAROCKS_URL} + -DEXPECTED_SHA256=${LUAROCKS_SHA256} + -DTARGET=luarocks + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure + --prefix=${DEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS} + --lua-suffix=jit + BUILD_COMMAND "" + INSTALL_COMMAND ${MAKE_PRG} bootstrap) +list(APPEND THIRD_PARTY_DEPS luarocks) +if(USE_BUNDLED_LUAJIT) + add_dependencies(luarocks luajit) +endif() + +add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build lua_cliargs 2.3-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build luafilesystem 1.6.3-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build dkjson 2.5-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build say 1.2-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build luassert 1.7.2-0 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build ansicolors 1.0.2-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build penlight 1.0.0-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build mediator_lua 1.1-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + COMMAND touch ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps + DEPENDS luarocks) +add_custom_target(stable-busted-deps + DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps) + +add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build busted 2.0.rc4 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + DEPENDS stable-busted-deps) +add_custom_target(busted + DEPENDS ${DEPS_BIN_DIR}/busted) + +# lua-messagepack doesn't depend on busted, but luarocks is unhappy to have +# two instances running in parallel. So we depend on busted to force it to +# be serialized. +add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build lua-messagepack CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + DEPENDS busted) +add_custom_target(lua-messagepack + DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lua-messagepack) + +# Like before, depend on lua-messagepack to ensure serialization of install +# commands +add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/lpeg + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build lpeg CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} + DEPENDS lua-messagepack) +add_custom_target(lpeg + DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/lpeg) + +add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client + COMMAND ${DEPS_BIN_DIR}/luarocks + ARGS build https://raw.githubusercontent.com/neovim/lua-client/8cc5b6090ac61cd0bba53ba984f15792fbb64573/nvim-client-0.0.1-11.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR} + DEPENDS lpeg libuv) +add_custom_target(nvim-client + DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client) + +list(APPEND THIRD_PARTY_DEPS stable-busted-deps busted lua-messagepack lpeg nvim-client) + + diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake new file mode 100644 index 0000000000..9368fed71a --- /dev/null +++ b/third-party/cmake/BuildMsgpack.cmake @@ -0,0 +1,24 @@ + +ExternalProject_Add(msgpack + PREFIX ${DEPS_BUILD_DIR} + URL ${MSGPACK_URL} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack + DOWNLOAD_COMMAND ${CMAKE_COMMAND} + -DPREFIX=${DEPS_BUILD_DIR} + -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/msgpack + -DURL=${MSGPACK_URL} + -DEXPECTED_SHA256=${MSGPACK_SHA256} + -DTARGET=msgpack + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake + CONFIGURE_COMMAND cmake ${DEPS_BUILD_DIR}/src/msgpack + -DMSGPACK_ENABLE_CXX=OFF + -DMSGPACK_BUILD_TESTS=OFF + -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC" + BUILD_COMMAND ${CMAKE_COMMAND} --build . + INSTALL_COMMAND ${CMAKE_COMMAND} + -DREMOVE_FILE_GLOB=${DEPS_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}msgpack*${CMAKE_SHARED_LIBRARY_SUFFIX}* + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InstallMsgpack.cmake) +list(APPEND THIRD_PARTY_DEPS msgpack) + |