summaryrefslogtreecommitdiff
path: root/src/testdir/test_options.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-19 21:07:04 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-19 21:07:04 +0100
commit673911457d6745b6b779eb769c2f41965592d12c (patch)
tree2bfcf65d74bce58f310c25cd68f17e41ac620fe7 /src/testdir/test_options.vim
parentd56a79d3396cf70861b7f739a3c400db91ce7b70 (diff)
downloadvim-673911457d6745b6b779eb769c2f41965592d12c.zip
patch 8.0.0342: double free with EXITFREE and setting 'ttytype'
Problem: Double free when compiled with EXITFREE and setting 'ttytype'. Solution: Avoid setting P_ALLOCED on 'ttytype'. (Dominique Pelle, closes #1461)
Diffstat (limited to 'src/testdir/test_options.vim')
-rw-r--r--src/testdir/test_options.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index 31a87af70..9ac46f243 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -235,3 +235,22 @@ func Test_set_errors()
call assert_fails("set showbreak=\x01", 'E595:')
call assert_fails('set t_foo=', 'E846:')
endfunc
+
+func Test_set_ttytype()
+ if !has('gui_running') && has('unix')
+ " Setting 'ttytype' used to cause a double-free when exiting vim and
+ " when vim is compiled with -DEXITFREE.
+ set ttytype=ansi
+ call assert_equal('ansi', &ttytype)
+ call assert_equal(&ttytype, &term)
+ set ttytype=xterm
+ call assert_equal('xterm', &ttytype)
+ call assert_equal(&ttytype, &term)
+ " FIXME: "set ttytype=" gives E522 instead of E529
+ " in travis on some builds. Why? Commented out this test for now.
+ " call assert_fails('set ttytype=', 'E529:')
+ call assert_fails('set ttytype=xxx', 'E522:')
+ set ttytype&
+ call assert_equal(&ttytype, &term)
+ endif
+endfunc