summaryrefslogtreecommitdiff
path: root/src/testdir/test_unlet.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-04 22:05:24 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-04 22:05:24 +0100
commitaf8af8bfac5792fa64efbc524032d568cc7754f7 (patch)
tree2d6bd98660f17197e6d630ccd2dc0be704e0dcd4 /src/testdir/test_unlet.vim
parentc71982b23978ef61d0a2f0fe5535e782e1c561ed (diff)
downloadvim-git-af8af8bfac5792fa64efbc524032d568cc7754f7.tar.gz
patch 7.4.1051v7.4.1051
Problem: Segfault when unletting "count". Solution: Check for readonly and locked first. (Dominique Pelle) Add a test.
Diffstat (limited to 'src/testdir/test_unlet.vim')
-rw-r--r--src/testdir/test_unlet.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim
new file mode 100644
index 000000000..f6705997a
--- /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