patch 7.4.1051
Problem: Segfault when unletting "count".
Solution: Check for readonly and locked first. (Dominique Pelle)
Add a test.
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index 9800afc..413e71b 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -8,3 +8,4 @@
source test_set.vim
source test_sort.vim
source test_undolevels.vim
+source test_unlet.vim
diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim
new file mode 100644
index 0000000..f670599
--- /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