comparison src/testdir/test_viminfo.vim @ 9256:26c7bf23ec1d v7.4.1911

commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 9 20:24:28 2016 +0200 patch 7.4.1911 Problem: Recent history lines may be lost when exiting Vim. Solution: Merge history using the timestamp.
author Christian Brabandt <cb@256bit.org>
date Thu, 09 Jun 2016 20:30:07 +0200
parents 636cfa97200e
children a00e32b5bb39
comparison
equal deleted inserted replaced
9255:8735c9123f66 9256:26c7bf23ec1d
114 call assert_equal("echo " . long800, histget(':', -2)) 114 call assert_equal("echo " . long800, histget(':', -2))
115 call assert_equal("echo 'one'", histget(':', -3)) 115 call assert_equal("echo 'one'", histget(':', -3))
116 116
117 call delete('Xviminfo') 117 call delete('Xviminfo')
118 endfunc 118 endfunc
119
120 func Test_cmdline_history_order()
121 call histdel(':')
122 call test_settime(11)
123 call histadd(':', "echo '11'")
124 call test_settime(22)
125 call histadd(':', "echo '22'")
126 call test_settime(33)
127 call histadd(':', "echo '33'")
128 wviminfo Xviminfo
129
130 call histdel(':')
131 " items go in between
132 call test_settime(15)
133 call histadd(':', "echo '15'")
134 call test_settime(27)
135 call histadd(':', "echo '27'")
136
137 rviminfo Xviminfo
138 call assert_equal("echo '33'", histget(':', -1))
139 call assert_equal("echo '27'", histget(':', -2))
140 call assert_equal("echo '22'", histget(':', -3))
141 call assert_equal("echo '15'", histget(':', -4))
142 call assert_equal("echo '11'", histget(':', -5))
143
144 call histdel(':')
145 " items go before and after
146 call test_settime(8)
147 call histadd(':', "echo '8'")
148 call test_settime(39)
149 call histadd(':', "echo '39'")
150
151 rviminfo Xviminfo
152 call assert_equal("echo '39'", histget(':', -1))
153 call assert_equal("echo '33'", histget(':', -2))
154 call assert_equal("echo '22'", histget(':', -3))
155 call assert_equal("echo '11'", histget(':', -4))
156 call assert_equal("echo '8'", histget(':', -5))
157
158 " Check sorting works when writing with merge.
159 call histdel(':')
160 call test_settime(8)
161 call histadd(':', "echo '8'")
162 call test_settime(15)
163 call histadd(':', "echo '15'")
164 call test_settime(27)
165 call histadd(':', "echo '27'")
166 call test_settime(39)
167 call histadd(':', "echo '39'")
168 wviminfo Xviminfo
169
170 call histdel(':')
171 rviminfo Xviminfo
172 call assert_equal("echo '39'", histget(':', -1))
173 call assert_equal("echo '33'", histget(':', -2))
174 call assert_equal("echo '27'", histget(':', -3))
175 call assert_equal("echo '22'", histget(':', -4))
176 call assert_equal("echo '15'", histget(':', -5))
177 call assert_equal("echo '11'", histget(':', -6))
178 call assert_equal("echo '8'", histget(':', -7))
179
180 call delete('Xviminfo')
181 endfunc