summaryrefslogtreecommitdiff
path: root/src/testdir/test_normal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-04 15:13:39 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-04 15:13:39 +0200
commitd77f9d595eb5f301b39b4373f2900a13c0ca30e2 (patch)
tree58c316bd7b326c259982525881be781f37e967f9 /src/testdir/test_normal.vim
parentbc54f3f3fed4dc3556df8c46cee6739d211b0eb2 (diff)
downloadvim-git-d77f9d595eb5f301b39b4373f2900a13c0ca30e2.tar.gz
patch 7.4.2323v7.4.2323
Problem: Using freed memory when using 'formatexpr'. (Dominique Pelle) Solution: Make a copy of 'formatexpr' before evaluating it.
Diffstat (limited to 'src/testdir/test_normal.vim')
-rw-r--r--src/testdir/test_normal.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 98cb7754b..34561ffba 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -192,6 +192,30 @@ func! Test_normal05_formatexpr()
bw!
endfu
+func Test_normal05_formatexpr_newbuf()
+ " Edit another buffer in the 'formatexpr' function
+ new
+ func! Format()
+ edit another
+ endfunc
+ set formatexpr=Format()
+ norm gqG
+ bw!
+ set formatexpr=
+endfunc
+
+func Test_normal05_formatexpr_setopt()
+ " Change the 'formatexpr' value in the function
+ new
+ func! Format()
+ set formatexpr=
+ endfunc
+ set formatexpr=Format()
+ norm gqG
+ bw!
+ set formatexpr=
+endfunc
+
func! Test_normal06_formatprg()
" basic test for formatprg
" only test on non windows platform