On So, 29 Okt 2017, Christian Brabandt wrote:
> On Sa, 28 Okt 2017, Bram Moolenaar wrote:
> > Feel free to make one.
>
> I kind of knew that this answer would come :)
>
> Okay, will look into that one and the other undefined behaviour patches.
>
> > I can't reproduce the error.
>
> I was thinking, it would still make sense to have them as test, even if
> those don't trigger the error in every environment.
Okay, how about this patch:
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index f6b1a43b8..7d31373c9 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1208,6 +1208,13 @@ func! Test_normal19_z_spell()
call assert_match("Word 'goood' added to ./Xspellfile2.add", a)
call assert_equal('goood', cnt[0])
+ " Test for :spellgood!
+ let temp=execute(':spe!0/0')
+ call assert_match('Invalid region', temp)
+ let spellfile=matchstr(temp, 'Invalid region nr in \zs.*\ze line \d: 0')
+ call assert_equal(['# goood', '# goood/!', '#oood', '0/0'], readfile(spellfile))
+ call delete(spellfile)
+
" clean up
exe "lang" oldlang
call delete("./Xspellfile.add")
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index b863fcbba..9e3b8783c 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -567,3 +567,22 @@ func Test_search_cmdline_incsearch_highlight_attr()
bwipe!
endfunc
+
+func Test_search_undefined_behaviour()
+ if !has("terminal")
+ return
+ endif
+ let h = winheight(0)
+ if h < 3
+ return
+ endif
+ " did cause an undefined left shift
+ let g:buf = term_start([GetVimProg(), '--clean', '-e', '-s', '-c', 'call search(getline("."))', 'samples/test000'], {'term_rows': 3})
+ call assert_equal([''], getline(1, '$'))
+ call term_sendkeys(g:buf, ":qa!\<cr>")
+ bwipe!
+endfunc
+
+func Test_search_undefined_behaviour2()
+ call assert_fails("call search('\\%UC0000000')", 'E486')
+endfu
This already includes a test for issue #2255, that currently fails.
Christian
--
Wie man sein Kind nicht nennen sollte:
Reiner Zufall