annotate src/testdir/test_changedtick.vim @ 13923:e4d5726e1678 v8.0.1832

patch 8.0.1832: cannot use :unlet for an environment variable commit https://github.com/vim/vim/commit/137374fd6538cf9dee0cb22907728d8fdecb5832 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 13 15:59:50 2018 +0200 patch 8.0.1832: cannot use :unlet for an environment variable Problem: Cannot use :unlet for an environment variable. Solution: Make it work. Use unsetenv() if available. (Ken Takata, closes #2855)
author Christian Brabandt <cb@256bit.org>
date Sun, 13 May 2018 16:00:07 +0200
parents fd1760f8c215
children 1f418d27e11f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10889
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for b:changedtick
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_changedtick_increments()
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " New buffer has an empty line, tick starts at 2.
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let expected = 2
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_equal(expected, b:changedtick)
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal(expected, b:['changedtick'])
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call setline(1, 'hello')
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let expected += 1
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(expected, b:changedtick)
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_equal(expected, b:['changedtick'])
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 undo
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " Somehow undo counts as two changes.
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let expected += 2
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(expected, b:changedtick)
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(expected, b:['changedtick'])
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 bwipe!
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfunc
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 func Test_changedtick_dict_entry()
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 let d = b:
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal(b:changedtick, d['changedtick'])
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endfunc
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 func Test_changedtick_bdel()
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 new
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let bnr = bufnr('%')
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let v = b:changedtick
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 bdel
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " Delete counts as a change too.
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(v + 1, getbufvar(bnr, 'changedtick'))
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
10912
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
35 func Test_changedtick_islocked()
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
36 call assert_equal(0, islocked('b:changedtick'))
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
37 let d = b:
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
38 call assert_equal(0, islocked('d.changedtick'))
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
39 endfunc
fd1760f8c215 patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents: 10908
diff changeset
40
10889
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 func Test_changedtick_fixed()
10908
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
42 call assert_fails('let b:changedtick = 4', 'E46:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
43 call assert_fails('let b:["changedtick"] = 4', 'E46:')
10889
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
10908
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
45 call assert_fails('lockvar b:changedtick', 'E940:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
46 call assert_fails('lockvar b:["changedtick"]', 'E46:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
47 call assert_fails('unlockvar b:changedtick', 'E940:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
48 call assert_fails('unlockvar b:["changedtick"]', 'E46:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
49 call assert_fails('unlet b:changedtick', 'E795:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
50 call assert_fails('unlet b:["changedtick"]', 'E46:')
10889
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 let d = b:
10908
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
53 call assert_fails('lockvar d["changedtick"]', 'E46:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
54 call assert_fails('unlockvar d["changedtick"]', 'E46:')
6b6abffbdf59 patch 8.0.0343: b:changedtick can be unlocked
Christian Brabandt <cb@256bit.org>
parents: 10889
diff changeset
55 call assert_fails('unlet d["changedtick"]', 'E46:')
10889
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
5780bd3a5a7e patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 endfunc