Mercurial > vim
diff src/testdir/test_unlet.vim @ 7498:3fcd3d235f7b v7.4.1051
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 4 22:05:24 2016 +0100
patch 7.4.1051
Problem: Segfault when unletting "count".
Solution: Check for readonly and locked first. (Dominique Pelle)
Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 04 Jan 2016 22:15:06 +0100 |
parents | |
children | f73876aa9a13 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/src/testdir/test_unlet.vim @@ -0,0 +1,26 @@ +" Tests for :unlet + +func Test_read_only() + try + " this caused a crash + unlet count + catch + call assert_true(v:exception =~ ':E795:') + endtry +endfunc + +func Test_existing() + let does_exist = 1 + call assert_true(exists('does_exist')) + unlet does_exist + call assert_false(exists('does_exist')) +endfunc + +func Test_not_existing() + unlet! does_not_exist + try + unlet does_not_exist + catch + call assert_true(v:exception =~ ':E108:') + endtry +endfunc