annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7498
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for :unlet
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_read_only()
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 try
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " this caused a crash
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 unlet count
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 catch
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_true(v:exception =~ ':E795:')
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endtry
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 func Test_existing()
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let does_exist = 1
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_true(exists('does_exist'))
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 unlet does_exist
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_false(exists('does_exist'))
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfunc
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 func Test_not_existing()
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 unlet! does_not_exist
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 try
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 unlet does_not_exist
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 catch
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_true(v:exception =~ ':E108:')
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endtry
3fcd3d235f7b commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc