blob: 13ec66b10302a0f9c84157249e6c7f8e1ab70466 [file] [log] [blame]
Bram Moolenaaraf8af8b2016-01-04 22:05:24 +01001" Tests for :unlet
2
3func Test_read_only()
4 try
5 " this caused a crash
6 unlet count
7 catch
8 call assert_true(v:exception =~ ':E795:')
9 endtry
Bram Moolenaar254b1052016-01-10 16:10:17 +010010 try
11 " this caused a crash
12 unlet errmsg
13 catch
14 call assert_true(v:exception =~ ':E795:')
15 endtry
Bram Moolenaaraf8af8b2016-01-04 22:05:24 +010016endfunc
17
18func Test_existing()
19 let does_exist = 1
20 call assert_true(exists('does_exist'))
21 unlet does_exist
22 call assert_false(exists('does_exist'))
23endfunc
24
25func Test_not_existing()
26 unlet! does_not_exist
27 try
28 unlet does_not_exist
29 catch
30 call assert_true(v:exception =~ ':E108:')
31 endtry
32endfunc