annotate src/testdir/test_changedtick.vim @ 32991:0bdb1f8a17c1 v9.0.1788

patch 9.0.1788: C4090 warnings in strings.c Commit: https://github.com/vim/vim/commit/4c215ecdafbc9a32bca885abc3272be741047291 Author: K.Takata <kentkt@csc.jp> Date: Sat Aug 26 18:05:08 2023 +0200 patch 9.0.1788: C4090 warnings in strings.c Problem: C4090 warnings in strings.c Solution: Add type casts closes: #12917 MSVC shows the following warnings: ``` strings.c(2436): warning C4090: 'function': different 'const' qualifiers strings.c(2774): warning C4090: 'function': different 'const' qualifiers strings.c(3865): warning C4090: 'function': different 'const' qualifiers ``` So add type casts to suppress them. Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ken .Takata <kentkt@csc.jp>
author Christian Brabandt <cb@256bit.org>
date Sat, 26 Aug 2023 18:15:04 +0200
parents 08940efa6b4e
children
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
17002
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
58
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
59 func Test_changedtick_not_incremented_with_write()
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
60 new
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
61 let fname = "XChangeTick"
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
62 exe 'w ' .. fname
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
63
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
64 " :write when the buffer is not changed does not increment changedtick
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
65 let expected = b:changedtick
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
66 w
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
67 call assert_equal(expected, b:changedtick)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
68
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
69 " :write when the buffer IS changed DOES increment changedtick
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
70 let expected = b:changedtick + 1
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
71 setlocal modified
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
72 w
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
73 call assert_equal(expected, b:changedtick)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
74
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
75 " Two ticks: change + write
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
76 let expected = b:changedtick + 2
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
77 call setline(1, 'hello')
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
78 w
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
79 call assert_equal(expected, b:changedtick)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
80
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
81 " Two ticks: start insert + write
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
82 let expected = b:changedtick + 2
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
83 normal! o
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
84 w
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
85 call assert_equal(expected, b:changedtick)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
86
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
87 " Three ticks: start insert + change + write
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
88 let expected = b:changedtick + 3
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
89 normal! ochanged
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
90 w
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
91 call assert_equal(expected, b:changedtick)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
92
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
93 bwipe
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
94 call delete(fname)
1f418d27e11f patch 8.1.1501: new behavior of b:changedtick not tested
Bram Moolenaar <Bram@vim.org>
parents: 10912
diff changeset
95 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 17002
diff changeset
96
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 17002
diff changeset
97 " vim: shiftwidth=2 sts=2 expandtab