-
-
Couldn't load subscription status.
- Fork 5.9k
Increase Test coverage for edit.c #1521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e1dd904 to
6ba644e
Compare
| endfunc | ||
|
|
||
| func! Test_edit_CTRL_() | ||
| " disabled for Windows builds, why? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, because you use non-ASCII characters in this script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. I tried setting encoding explicitly to utf-8 but that does not work. I am possibly missing some ifdef feature or something. See this and that. The second one is especially mysterious, since at the specified line encoding is reset and all :bw commands use the ! attribute. So for now I have disabled this test, until the test_edit script is finished and then will check again.
This PR adds many tests, that should increase the coverage for edit.c by quite a lot. Also to make testing easier there are two small changes to the C core of Vim: 1) A new function test_disable(name, val) this can be used to have redrawing() always return false (similar to how test_disable_char_avail() function currently works 2) a function that checks if Vim was called with --not-a-term argument and in that case skip the 2s delay when displaying error messages The rest should be self explanatory
|
rebased to 8.0.0425 |
src/testdir/test_edit.vim
Outdated
| set foldopen+=hor | ||
| call setline(1, ['abc', 'def']) | ||
| call cursor(1, 1) | ||
| call feedkeys("AX\<Home>X\<esc>", 'tnix') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You insert the same letter X at the beginning and at the end.
Better insert a different letter (like "XabcY") because if and were swapped, your test would spuriously pass.
It may also be worth checking and when setting 'rightleft'.
src/testdir/test_edit.vim
Outdated
| call feedkeys("A\<c-t>xyz", 'tnix') | ||
| call assert_equal(["\<tab>abcxyz"], getline(1, '$')) | ||
| set nopaste | ||
| " CTRL-X CTRL-T (thesaurus complete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing parenthesis.
| call cursor(1, 1) | ||
| call feedkeys("i\<Insert>Z\<Insert>YX>", 'tnix') | ||
| call assert_equal(['ZYX>bc', 'def'], getline(1, '$')) | ||
| endfunc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing bw! before returning from the test?
|
thanks @dpelle I updated the test acccording to your comments. |
|
Is this ready to include now? |
|
yes it is ready. You might want to review the changes to the C Core however. |
|
yes it is ready. You might want to review the changes to the C Core however.
OK, here are a few comments.
In Test_edit_CTRL_K() redrawing is disabled near the end.
But it seems it's just testing a digraph:
call feedkeys("A\<c-k>a:\<esc>", 'tnix')
call assert_equal(['ä'], getline(1, '$'))
Doesn't this work without disabling redrawing?
f_test_disable() should use STRCMP(), not STRNCMP(). I see:
call test_disable("char_avail", 1)
and:
call test_disable('char', 1)
That last one should not work.
When we use test_disable(), we should remove test_disable_char_avail().
When we add more to test_disable() it may not quite fit the name. How
about calling it test_override()? Then we can also use it for enabling
something.
Would also be nice to be able to do:
test_override("ALL", 0)
So that we can reset all overrides in runtest.vim
Using --not-a-term for skipping the delay isn't quite right. The
argument is to surpress the message and delay for detecting that the
input and output are not connected to a terminal. It should not have
other sice effects. Better use v:testing.
…--
From "know your smileys":
:-)-O Smiling doctor with stethoscope
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
|
@brammool adjusted according to your comments.
|
|
Christian Brabandt wrote:
@brammool adjusted according to your comments.
regarding point
1) it is there to make sure, that [this](https://github.com/vim/vim/blob/master/src/edit.c#L8302-L8311) part of the code is run through while testing, I think there was an error in the test script so I changed is slightly.
2) renamed test_disable to test_override, allow extra argument "ALL", removed the test_disable_char_avail() function and changed all other tests to use the new test_override function.
3) changed the --not-a-term check and let it test against v:testing.
Thanks for the quick response!
I'm anxious to include this, so I'll make some final tweaks:
- use tabs instead of spaces
- explain the use of {val} argument of test_override()
- fix the failure with a shadow directory
…--
From "know your smileys":
%-) After staring at screen for 15 hours
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim#1521)
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim#1521)
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim#1521)
[Nvim note: test_override() omitted]
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim/vim#1521)
vim/vim@eb992cb
[Nvim note: test_override() omitted]
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim/vim#1521)
vim/vim@eb992cb
[Nvim note: test_override() omitted]
Problem: Not enough test coverage in Insert mode.
Solution: Add lots of tests. Add test_override(). (Christian Brabandt,
closes vim/vim#1521)
vim/vim@eb992cb
This is work in progress. I just want to see how coveralls changes. Will notify once this is ready to be included.