summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-20 18:35:10 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-20 18:41:42 +0200
commitab9f2ecfd4ecaf74eeed0e5ec41355589af3ec8f (patch)
tree69b60a7f93070e086eab544964c59d0de6b6bd61 /src/testdir
parentf9037f186ad45b56c84f1efdc131480bec159e4f (diff)
patch 9.0.1763: crash when passing invalid buffer to undotree()v9.0.1763
Problem: crash when passing invalid buffer to undotree() Solution: Use get_buf_arg() instead of tv_get_buf_from_arg(). closes: #12862 closes: #12830 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_undo.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim
index 461b28f697..368ebbe916 100644
--- a/src/testdir/test_undo.vim
+++ b/src/testdir/test_undo.vim
@@ -134,6 +134,18 @@ func Test_undotree_bufnr()
call assert_notequal(d1, d)
call assert_equal(d2, d)
+ " error cases
+ call assert_fails('call undotree(-1)', 'E158:')
+ call assert_fails('call undotree("nosuchbuf")', 'E158:')
+
+ " after creating a buffer nosuchbuf, undotree('nosuchbuf') should
+ " not error out
+ new nosuchbuf
+ let d = {'seq_last': 0, 'entries': [], 'time_cur': 0, 'save_last': 0, 'synced': 1, 'save_cur': 0, 'seq_cur': 0}
+ call assert_equal(d, undotree("nosuchbuf"))
+ " clean up
+ bw nosuchbuf
+
" Drop created windows
set ul&
new