Commit Graph

29 Commits

Author SHA1 Message Date
ZyX
7849070f99 tests: Add missing test cases 2017-11-06 01:17:39 +03:00
ZyX
7bc6de7526 api/vim,functests: Add tests for nvim_parse_expression, fix found bugs 2017-11-06 01:17:39 +03:00
ZyX
3ecb95298f tests: Fix testlint errors 2017-11-06 01:17:37 +03:00
ZyX
6c19cbef26 viml/parser/expressions,tests: Add AST freeing, with sanity checks 2017-10-15 20:05:35 +03:00
ZyX
c286155bfa viml/parser/expressions: Create tests for latest additions 2017-10-15 19:13:52 +03:00
ZyX
af38cea133 viml/parser/expressions: Add support for string parsing 2017-10-15 19:13:52 +03:00
ZyX
520c0b91a5 test/helpers: Add format_string and format_luav
First intended to provide %r functionality like in Python (and also support for 
%*.*s, but this was not checked), second adds nice table formatting for use in 
cases similar to screen:snapshot_util().
2017-09-29 01:21:07 +03:00
ZyX
607dc3e0f9 functests: Add tests 2017-06-21 10:58:47 +03:00
ZyX
09f849b600 Merge branch 'master' into luaviml'/lua 2017-05-08 15:43:45 +03:00
Justin M. Keyes
58d2ce9bdb test: check_cores(): Escape $TMPDIR path. (#6520)
Lua string:match() considers hyphen to be a special char, we want the
path to be a literal match. Also remove "./", etc.

References #6483
2017-04-14 20:34:54 +02:00
ZyX
ab4d13e2fa Merge branch 'master' into luaviml'/lua 2017-04-10 22:21:06 +03:00
Justin M. Keyes
26bf6e6f6f test/check_cores(): Skip workspace-local temp dir. (#6483)
Avoids this error:
    ./test/helpers.lua:27: cannot open ./Xtest-tmpdir/nvimfqH9dL: No such file or directory
    stack traceback:
        ./test/helpers.lua:27: in function 'glob'
        ./test/helpers.lua:195: in function 'check_cores'
        ./test/functional/helpers.lua:628: in function <./test/functional/helpers.lua:626>
2017-04-09 15:49:31 +02:00
ZyX
a83511d1a1 unittests: Move checking cores to check_child_err 2017-04-08 04:48:58 +03:00
ZyX
043d8ff9f2 Merge branch 'master' into luaviml'/lua 2017-04-08 01:54:58 +03:00
ZyX
9dd0d4f8b9 unittests: Add trace description right to the error message 2017-04-01 12:52:28 +03:00
Justin M. Keyes
1ea9ebf112 test: Use workspace-local temp directory.
Closes #6291
2017-03-30 02:55:00 +02:00
ZyX
ffaf7c7521 unittests: Add tv_dict_item_{alloc,free} tests 2017-03-29 10:08:45 +03:00
ZyX
a3ea05c1e5 functests: Add some tests 2017-03-27 00:12:22 +03:00
ZyX
9d1b439fb7 tests: Allow lfs.attributes to be NULL when traversing FS 2017-03-12 00:25:55 +03:00
ZyX
ec730daee9 unittests: Do not use which, add data to paths.lua.in instead 2017-03-11 23:23:50 +03:00
ZyX
9400466282 unittests: Check core dumps in after_each, like in functests 2017-03-11 23:23:49 +03:00
Justin M. Keyes
152921837e test: screen_setup(): Detect spawn failures, usage errors. 2017-02-26 13:00:01 +01:00
ZyX
943531cf9e ci: Make sure core* is the last component of path 2017-02-14 00:33:52 +03:00
ZyX
d670591887 ci: Better core dump checking
- Do not exclude any directories from `find` search, remove dumps before tests
  instead.
- Install `apport` on travis so that linux tests should produce core dumps
  (based on information from travis-ci/travis-ci#3754, not sure whether it still
  applies).
- Check cores in lua so that one has an idea which test is failing exactly. Do
  this only 10% of time on linux because traversing the file system is slow.

Unit tests are still not touched, though it is what `app` argument in
`check_cores` is for.

TODO? consider using `find`, it may be faster. Consider retiring `os.execute`,
      dealing with escaping is bad.
2017-02-14 00:33:52 +03:00
Justin M. Keyes
043d8ba422 Merge #5782 'Visual-mode put from @. register' 2017-01-22 11:10:24 +01:00
Justin M. Keyes
e40946a5be win: test: enable job_spec.lua
- Default to powershell.
- Avoid hardcoded "-c".
- Remove ^M character from received lines.
- pending_win32(): clear() is unnecessary and it pollutes the tests.

Closes #3973
Helped-by: Rui Abreu Ferreira <raf-ep@gmx.com>
2017-01-19 09:55:57 +01:00
Matthew Malcomson
b7ee8fbc81 put fixup, esp. ". register close #5709 #5781
Note some bugs were judged to have too ugly a fix to solve, tests to
demonstrate these problems, and the explanation behind not fixing them
are below.

describe('register . problems', function()
  before_each(reset)

  -- The difficulty here is: The basic requirement is that the text
  -- inserted is treated as if it were typed in insert mode. This is why
  -- the paste method is to enter insert mode and enter the ". register
  -- into readbuf1.
  -- We can't add a count into the readbuf here because the insert mode
  -- count is implemented with readbuf2 which is checked for characters
  -- after readbuf1.
  -- Hence, the ".gp command (which adds extra characters into readbuf1
  -- to emulate leaving the cursor after the text by moving the cursor
  -- after inserting the text) would insert the motion characters into
  -- the buffer instead of using them to move after the insert has been
  -- done.
  -- I could probably get this working properly with a special flag put
  -- into start_redo_ins() and set in do_put(), but I think this adds
  -- much more complexity than fixing this bug justifies.
  pending('should not change the ". register with ".2p', function()
    local orig_register = funcs.getreg('.')
    feed('2".p')
    eq(orig_register, funcs.getreg('.'))
  end)

  describe("cursor positioning after undo and redo with '.'", function()
    before_each(reset)
    local function make_cursor_test(macro_string)
      return function()
        feed(macro_string)
        local afterpos = funcs.getcurpos()
        local orig_string = curbuf_contents()
        feed('u.')
        eq(afterpos, funcs.getcurpos())
        expect(orig_string)
      end
    end
    -- The difficulty here is: setting the cursor after the end of the
    -- pasted text is done by adding a motion command to the
    -- stuffbuffer after the insert.
    -- Modifying 'redobuff' is done in the code that handles inserting
    -- text and moving around.
    -- I could add a special case in ins_esc() that checks for a flag
    -- set in do_put() to add the motion character to the redo buffer,
    -- but I think that is starting to get way too convoluted for the
    -- benefit.
    pending('should be the same after ".gp and ".gpu.',
            make_cursor_test('".gp'))
    -- The difficulty here is: putting forwards is implemented by using
    -- 'a' instead of 'i' to start insert.
    -- Undoing with 'u' an insert that began with 'a' leaves the cursor
    -- where the first character was inserted, not where the cursor was
    -- when the 'a' was pressed.
    -- We account for this the first time by saving the cursor position
    -- in do_put(), but this isn't stored in redobuff for a second time
    -- around.
    -- We can't change how such a fundamental action as undo after
    -- inserting with 'a' behaves, we could add in a special case
    -- whereby we set a flag in do_put() and read it when entering
    -- insert mode but this seems like way too much to fix such a minor
    -- bug.
    pending('should be the same after ".pu. and ".pu.u.',
            make_cursor_test('".pu.'))
  end)
end)
2017-01-18 12:28:10 +00:00
ZyX
410d18ef5c unittest: Allow multiple indirect includes
Works by saving all preprocessor defines and reusing them on each run. This also
saves NVIM_HEADER_H defines. Saving other defines is needed for defines like
`Map(foo, bar)` which are sometimes used to declare types or functions. Saving
types or function declarations is not needed because they are recorded as luajit
state.

Fixes #5857
2017-01-03 22:54:54 +03:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00