Commit Graph

440 Commits

Author SHA1 Message Date
Justin M. Keyes
8f09fa1a49 os/fs.c: remove os_file_is_readonly()
os_file_is_readonly() in its current form is equivalent to
!os_file_is_writable(). This does not appear to be a bug, because Vim's
use of check_file_readonly() (which we changed to os_file_is_readonly())
is equivalent to !os_file_is_writable() in every case.

os_file_is_readonly() also fails this test:

    returns false if the file is non-read, non-write

A more useful form would define behavior under these cases:

  - path is executable (but not writable)
  - path is non-existent
  - path is directory

But there is no reason for os_file_is_readonly() to exist, so remove it.
2015-08-17 01:15:04 -04:00
Justin M. Keyes
d5cd15e67f test: more cases for os_file_is_readonly() 2015-08-17 01:14:13 -04:00
Justin M. Keyes
ad6b356119 test: cover os_file_is_readable() 2015-08-17 01:07:48 -04:00
Thiago de Arruda
a6e0d35d2d queue: Implement a more flexible event queue 2015-08-13 08:46:21 -03:00
Thiago de Arruda
0d71354058 test: Make sure ENTER prompt is exited in clipboard_provider_spec
The test may hang without this.
2015-08-13 07:41:04 -03:00
Justin M. Keyes
d21690a66e test: cover :grep
References #3156
2015-08-11 12:49:50 -04:00
Justin M. Keyes
5c1dc0fbe7 test: fix pending() invocations
AFAICT busted does not report pending() invocations without the 2nd
argument.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
62c53c404b test: move runtime/autoload/* to provider/
- Organize tests by logical function, not the literal impl location.
- Avoid deep nesting / hyper-hierarchy.
2015-08-09 22:33:28 -04:00
Justin M. Keyes
698482ec3e test: python: report pending() if python{2,3} is missing 2015-08-09 22:33:28 -04:00
Marco Hinz
990c0350ab vim-patch:7.4.773 #3066
Problem:  'langmap' is used in command-line mode when checking for mappings.
Solution: Do not use 'langmap' in command-line mode. (Larry Velazquez)

Original patch:
  https://code.google.com/p/vim/source/detail?r=5b1eefbf9a532f32a66fa13abbd671488aaafd5c
2015-08-09 21:12:11 -04:00
Björn Linse
d4ebbaa91a clipboard: support clipboard=unnamedplus,unnamed 2015-08-07 13:06:13 +02:00
Justin M. Keyes
5a19585865 test: cover msgpackparse() regression 2015-08-05 19:08:06 -04:00
Justin M. Keyes
9f350e615c Merge pull request #3034 from ZyX-I/msgpack-eval
msgpack viml functions for dump/restore
2015-08-03 00:24:10 -04:00
ZyX
030f360312 functests: Use eval subdirectory in place of viml 2015-08-02 22:19:58 +03:00
ZyX
7fbefd585e eval: Remove most of msgpack* functions limitations 2015-08-02 19:32:41 +03:00
ZyX
5a7135fa1c eval: Add msgpackparse and msgpackdump functions 2015-08-02 19:32:41 +03:00
Justin M. Keyes
efa059c5a4 test: call scandir_next_with_dots() more than once
Also cosmetic reduction.
2015-08-01 23:33:54 -04:00
Felipe Morales
ea551044ea Add the . and .. entries to glob()
os_scandir() and os_scandir_next() skip over those, because of the
unverlying libuv funcitons behaviour.

Fixes #2954
2015-08-01 23:16:17 -04:00
Omar Sandoval
f79025b9de tui: Use underline cursor in Replace mode
This is a port of my original contribution to Vim, added in 7.4.687
(https://github.com/vim/vim/commit/v7-4-687). The TUI code has been
heavily refactored (see esp. 25ceadab37),
so this required some translation, but the logic is the same.
2015-07-26 23:45:41 -04:00
Omar Sandoval
fa48fc667a api: Simplify UI API on mode change
Currently, there are two functions in the UI API that are called when
the mode changes: insert_mode() and normal_mode(). These can be folded
into a single mode_change() entrypoint which can do whatever it wants
based on the mode it is passed, limited to INSERT and NORMAL for now.
2015-07-26 23:38:35 -04:00
ZyX
1206ac953f os/fs: Move mkdir_recurse from eval.c to os/fs.c 2015-07-26 02:34:32 +03:00
Björn Linse
7a6bf3f418 Add ui test for default title (with/without filename) #3091 2015-07-23 22:35:42 +02:00
Robin Allen
5ad619a847 menu: Fix :emenu mode detection #2992
A menu item can have separate bindings for each Vim mode.

:emenu checks to see which binding it should execute. But, it assumes
it can only be called from Normal mode, so its mode detection is based
on some guesswork. For instance, it detects if you've just used C-O
and, if so, uses the Insert mode binding.

Now that :emenu can be called from any mode (via vim_command), this
commit has it check the actual mode we're in, and simply use the
binding for that mode if we aren't in Normal mode.
2015-07-22 10:13:49 -04:00
Lucas Hoffmann
6571c84d54 tests: Migrate legacy test 80. #2989
The test is also split in several blocks and heavily modernized.  This was
done to prevent the following quoting and escaping problems during migration:
- the vim command `put =...` treats double quotes as the start of a comment so
  they have to be escaped with a backslash
- when inserting control characters on the command line they have to be
  escaped with <C-V>

The parts one and two of the test are functional identical so they are wrapped
in a local function. The only difference was which letters where used to test
the same feature.

Part six did test a flag in 'cpoptions' that has been removed in neovim.  It
has therefore been removed as well.

Reviewed-by: Michael Reed <Pyrohh@users.noreply.github.com>
2015-07-21 19:56:15 -04:00
Björn Linse
8047570b70 clipboard: add tests for error fallback and middleclick paste 2015-07-20 20:24:28 -04:00
Marco Hinz
2b2cea38a9 Test: fix functional/ex_cmds/recover_spec.lua
os.remove() wasn't removing the temporary swap directory which leads to
problems when the test is run a second time.

That's also the reason why the CI never caught this.

os.remove() got replaced by helpers.rmdir().
2015-07-20 22:19:16 +02:00
Marco Hinz
0f34b256aa Test: add new helper function: rmdir()
- lfs.rmdir() only removes empty directories

- os.remove() supercedes lfs.rmdir(); removes files and empty directories

- helpers.rmdir() first removes all files within a directory, then the
  directory itself
2015-07-20 22:19:07 +02:00
Sebastian Witte
fcb79ffc40 Implement API function to call functions #2979
Remove static modifier from func_call
Move MAX_FUNC_ARGS definnition from eval.c to eval.h
2015-07-19 17:18:31 +02:00
Lucas Hoffmann
42d38b363c tests: Split migrated test 57. 2015-07-19 04:06:45 +02:00
Lucas Hoffmann
1b2eb306f7 tests: Migrate legacy test 57. 2015-07-19 04:06:45 +02:00
Marco Hinz
9d876eb037 Test: synIDattr(): true color awareness 2015-07-18 16:55:25 +02:00
Thiago de Arruda
991d3ec1e6 event loop: New abstraction layer with refactored time/signal API
- Add event loop abstraction module under src/nvim/event. The
  src/nvim/event/loop module replaces src/nvim/os/event
- Remove direct dependency on libuv signal/timer API and use the new abstraction
  instead.
- Replace all references to uv_default_loop() by &loop.uv, a new global variable
  that wraps libuv main event loop but allows the event loop functions to be
  reused in other contexts.
2015-07-17 00:19:19 -03:00
Thiago de Arruda
9e42ef4e13 test: lower sleep value in job test
Since sleep is a grandchild of nvim, it is not killed after the test ends.
Using a low sleep value allows it to exit automatically after a small interval.
2015-07-16 23:10:01 -03:00
Thiago de Arruda
e85c9966b8 test: Increase determinism in screen_basic_spec tests 2015-07-16 23:08:09 -03:00
Lucas Hoffmann
d88c93acf3 tests: Style improvements and Makefile fix for migrated test 60. #2975 2015-07-16 20:31:20 -04:00
Justin M. Keyes
7b56a8230f test: buffer_spec: fix set_line invocation
- pcall result was always false because of wrong arity
- also re-arrange tests into it() blocks
2015-07-11 22:33:05 -04:00
Nick Hynes
c2f14bb89c test: api: exercise out-of-bounds line slicing 2015-07-11 18:20:35 -04:00
Lucas Hoffmann
c51d0e49a9 tests: Modernize migrated legacy test 62.
- use eval() and eq() in many places instead of writing to the buffer
- remove has('autocmd') checks and use corresponding code unconditionally as
  neovim always has the autocmd feature
- split the test into several it() blocks

Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-07-11 00:55:16 +02:00
Lucas Hoffmann
98c022c329 tests: Migrate legacy test 62. 2015-07-11 00:47:49 +02:00
Michael Reed
1b78ad1c4d Merge pull request #2932 from lucc/helpers/write_file
[RDY] tests: Add write_file helper function

Reviewed-by: Florian Walch <florian@fwalch.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
2015-07-06 04:07:23 -04:00
Björn Linse
e9c9d44f65 clipboard: don't overwrite before pasting in visual mode. #2945
This occured when clipboard=unnamedplus and doing "+p in visual mode.
Fixes #2942.
2015-07-04 18:17:30 +02:00
Thiago de Arruda
0ef80b9c2b rbuffer: Reimplement as a ring buffer and decouple from rstream
Extract the RBuffer class from rstream.c and reimplement it as a ring buffer,
a more efficient version that doesn't need to relocate memory.

The old rbuffer_read/rbuffer_write interfaces are kept for simple
reading/writing, and the RBUFFER_UNTIL_{FULL,EMPTY} macros are introduced to
hide wrapping logic when more control is required(such as passing the buffer
pointer to a library function that writes directly to the pointer)

Also add a basic infrastructure for writing helper C files that are only
compiled in the unit test library, and use this to write unit tests for RBuffer
which contains some macros that can't be accessed directly by luajit.

Helped-by: oni-link <knil.ino@gmail.com>
Reviewed-by: oni-link <knil.ino@gmail.com>
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
2015-07-01 05:40:53 -03:00
Thiago de Arruda
c8c5af5a7a test: Ensure proper initialization in unit/helpers.lua
Remove helpers.vim_init and simply perform the required initialization in
helpers.lua.
2015-07-01 05:40:53 -03:00
Lucas Hoffmann
8f4e3a68a8 tests: Use new write_file() function in tests. 2015-06-30 18:06:06 +02:00
Lucas Hoffmann
652ee0348c tests: Use write_file() in source(). 2015-06-30 18:06:06 +02:00
Lucas Hoffmann
f0850775bf tests: Add helpers.write_file() to write short files. 2015-06-30 18:06:06 +02:00
Nick Hynes
105b8f1070 rplugin: allow users to register hosts #2896 2015-06-25 19:01:38 -04:00
Justin M. Keyes
f78bf64771 api: vim_set_var() should return the old value #2899
Closes #2816
2015-06-25 01:26:17 -04:00
Justin M. Keyes
20a57c497b tests: 061_undo_tree_spec: minor edits 2015-06-22 22:56:16 -04:00
Lucas Hoffmann
c411fb6cda tests: Repeat a flaky part of the migrated test 61.
This is the part of the test that relies on wall clock time and sometimes
fails if the system is under load.  The test is repeated up to three times
before a failure is reported to the user.
2015-06-22 17:05:10 +02:00