Skip to content

Improved test coverage of diff mode and fixed memory error#1685

Closed
dpelle wants to merge 7 commits intovim:masterfrom
dpelle:impr-cov-diff
Closed

Improved test coverage of diff mode and fixed memory error#1685
dpelle wants to merge 7 commits intovim:masterfrom
dpelle:impr-cov-diff

Conversation

@dpelle
Copy link
Copy Markdown
Member

@dpelle dpelle commented May 6, 2017

This PR improves test coverage of diff mode:

  • test vertical, horizontal, iwhite and icase values of 'diffopt' option
  • test normal commands "dp" and "do" with a buffer number

@dpelle
Copy link
Copy Markdown
Member Author

dpelle commented May 6, 2017

Interestingly, the newly added tests Test_diffopt_horizontal() and
Test_diffopt_vertical() uncover a bug with the asan build in Travis
(heap overflow). Bug is not introduced my my PR since PT only
adds tests. Function foldmethodIsManual(...) is called with
wp->w_p_fdm being an empty string, so access to
wp->w_p_fdm[3] causes a memory error at fold.c:308:

    306 foldmethodIsManual(win_T *wp)
    307 {
!!!!308     return (wp->w_p_fdm[3] == 'u');
    309 }

We could check that length of wp->w_p_fdm is
at least 4, but I suppose that w_p_fdm should never
be an empty string so, so it would be a workaround.

I don't have a fix for this yet.

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 7, 2017

Codecov Report

Merging #1685 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1685     +/-   ##
=========================================
+ Coverage   74.85%   74.95%   +0.1%     
=========================================
  Files          76       76             
  Lines      124942   124904     -38     
=========================================
+ Hits        93521    93624    +103     
+ Misses      31421    31280    -141
Impacted Files Coverage Δ
src/diff.c 81.85% <100%> (+4.83%) ⬆️
src/version.c 79.29% <0%> (-1.02%) ⬇️
src/if_py_both.h 75.56% <0%> (-0.46%) ⬇️
src/message.c 68.07% <0%> (-0.21%) ⬇️
src/gui.c 45.56% <0%> (+0.05%) ⬆️
src/move.c 85.98% <0%> (+0.08%) ⬆️
src/screen.c 74.24% <0%> (+0.13%) ⬆️
src/channel.c 83.85% <0%> (+0.18%) ⬆️
src/evalfunc.c 81.1% <0%> (+0.2%) ⬆️
src/eval.c 80.82% <0%> (+0.21%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4475b62...c287859. Read the comment docs.

@dpelle dpelle changed the title Improved test coverage of diff mode Improved test coverage of diff mode and fixed memory error May 7, 2017
@dpelle
Copy link
Copy Markdown
Member Author

dpelle commented May 7, 2017

Test_diffopt_horizontal() and Test_diffopt_vertical() uncover
a bug with the asan build in Travis (heap overflow).

The heap overflow found by new tests is now fixed in this PR.

dpelle added 2 commits May 8, 2017 20:58
When entering :diffsplit followed by :diffoff, w_p_fdm_save is empty
and it is best to restore 'fdm' to "manual" rather than leaving set
to 'diff'.
@brammool
Copy link
Copy Markdown
Contributor

brammool commented May 11, 2017 via email

@dpelle
Copy link
Copy Markdown
Member Author

dpelle commented May 12, 2017

With a sequence of changes like this, I can't possibly tell when it's done.
Please add a comment when this is ready to include.

PR is ready to be included.

@brammool
Copy link
Copy Markdown
Contributor

brammool commented May 14, 2017 via email

@brammool brammool closed this in 79a213d May 16, 2017
desvp pushed a commit to desvp/vim that referenced this pull request May 30, 2017
Problem:    diff mode is insufficiently tested
Solution:   Add more test cases. (Dominique Pelle, closes vim#1685)
dpelle pushed a commit to dpelle/vim that referenced this pull request Jul 31, 2017
Problem:    diff mode is insufficiently tested
Solution:   Add more test cases. (Dominique Pelle, closes vim#1685)
justinmk added a commit to justinmk/neovim that referenced this pull request Jan 21, 2018
Problem:    diff mode is insufficiently tested
Solution:   Add more test cases. (Dominique Pelle, closes vim/vim#1685)

vim/vim@79a213d

NA / already applied:
---------------------
vim-patch:8.0.0421: diff mode wrong when adding line at end of buffer
Problem:    Diff mode is displayed wrong when adding a line at the end of a
            buffer.
Solution:   Adjust marks in diff mode. (James McCoy, closes vim/vim#1329)
vim/vim@f58a847
justinmk added a commit to justinmk/neovim that referenced this pull request Jan 21, 2018
Problem:    diff mode is insufficiently tested
Solution:   Add more test cases. (Dominique Pelle, closes vim/vim#1685)

vim/vim@79a213d

NA / already applied:
---------------------
vim-patch:8.0.0421: diff mode wrong when adding line at end of buffer
Problem:    Diff mode is displayed wrong when adding a line at the end of a
            buffer.
Solution:   Adjust marks in diff mode. (James McCoy, closes vim/vim#1329)
vim/vim@f58a847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants