Mercurial > vim
annotate src/testdir/test_unlet.vim @ 15430:d94901eeb762 v8.1.0723
patch 8.1.0723: cannot easily run specific test when in src/testdir
commit https://github.com/vim/vim/commit/ec50401e1e1357a1340b3c92109fd4860e38a8ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 11 17:30:16 2019 +0100
patch 8.1.0723: cannot easily run specific test when in src/testdir
Problem: Cannot run specific test when in src/testdir the same was as in
the src directory.
Solution: Move build rule to src/testdir/Makefile.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Jan 2019 17:45:05 +0100 |
parents | a94bc6a7b29e |
children | da98d2ed8dc5 |
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() |
7595
99e93f72ff91
commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents:
7562
diff
changeset
|
4 " these caused a crash |
99e93f72ff91
commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents:
7562
diff
changeset
|
5 call assert_fails('unlet count', 'E795:') |
99e93f72ff91
commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents:
7562
diff
changeset
|
6 call assert_fails('unlet errmsg', 'E795:') |
7498
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 endfunc |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func Test_existing() |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let does_exist = 1 |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_true(exists('does_exist')) |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 unlet does_exist |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_false(exists('does_exist')) |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunc |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 func Test_not_existing() |
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 unlet! does_not_exist |
7595
99e93f72ff91
commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents:
7562
diff
changeset
|
18 call assert_fails('unlet does_not_exist', 'E108:') |
7498
3fcd3d235f7b
commit https://github.com/vim/vim/commit/af8af8bfac5792fa64efbc524032d568cc7754f7
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
10910
8bff367672a4
patch 8.0.0344: unlet command leaks memory
Christian Brabandt <cb@256bit.org>
parents:
7595
diff
changeset
|
20 |
8bff367672a4
patch 8.0.0344: unlet command leaks memory
Christian Brabandt <cb@256bit.org>
parents:
7595
diff
changeset
|
21 func Test_unlet_fails() |
8bff367672a4
patch 8.0.0344: unlet command leaks memory
Christian Brabandt <cb@256bit.org>
parents:
7595
diff
changeset
|
22 call assert_fails('unlet v:["count"]', 'E46:') |
8bff367672a4
patch 8.0.0344: unlet command leaks memory
Christian Brabandt <cb@256bit.org>
parents:
7595
diff
changeset
|
23 endfunc |
13923
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
24 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
25 func Test_unlet_env() |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
26 let envcmd = has('win32') ? 'set' : 'env' |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
27 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
28 let $FOOBAR = 'test' |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
29 let found = 0 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
30 for kv in split(system(envcmd), "\r*\n") |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
31 if kv == 'FOOBAR=test' |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
32 let found = 1 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
33 endif |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
34 endfor |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
35 call assert_equal(1, found) |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
36 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
37 unlet $FOOBAR |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
38 let found = 0 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
39 for kv in split(system(envcmd), "\r*\n") |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
40 if kv == 'FOOBAR=test' |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
41 let found = 1 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
42 endif |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
43 endfor |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
44 call assert_equal(0, found) |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
45 |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
46 unlet $MUST_NOT_BE_AN_ERROR |
e4d5726e1678
patch 8.0.1832: cannot use :unlet for an environment variable
Christian Brabandt <cb@256bit.org>
parents:
10910
diff
changeset
|
47 endfunc |
14059
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
48 |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
49 func Test_unlet_complete() |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
50 let g:FOOBAR = 1 |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
51 call feedkeys(":unlet g:FOO\t\n", 'tx') |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
52 call assert_true(!exists('g:FOOBAR')) |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
53 |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
54 let $FOOBAR = 1 |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
55 call feedkeys(":unlet $FOO\t\n", 'tx') |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
56 call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) |
a94bc6a7b29e
patch 8.1.0047: no completion for :unlet $VAR
Christian Brabandt <cb@256bit.org>
parents:
13923
diff
changeset
|
57 endfunc |