Monday, February 5, 2018

Writing tests for completion

I would like to automate the testing of my completion plugin,
so I have started to write functions like this (I am using
a test framework like the one in Vim):

fun! Test_buffer_keyword_completion()
new
set completeopt=menuone,noselect
call feedkeys("ajump ju\<C-X>\<C-N>\<C-N>\<ESC>", "x")
call assert_equal("jump jump", getline(1))
bwipe!
endf

This test passes (using `vim --clean`), but if I feed this
key sequence instead:

call feedkeys("ajump ju\<C-X>\<C-N>\<C-P>\<ESC>", "x")

the test fails:

Expected 'jump jump' but got 'jump ju'

Why is that? If I try the key sequences manually, both give the
same result.

Thanks,
Life.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment