Mercurial > vim
comparison src/testdir/test_mksession.vim @ 28083:f1c00b8085f6 v8.2.4566
patch 8.2.4566: check for existing buffer in session file may not work
Commit: https://github.com/vim/vim/commit/7d42840033aedf36389208b62e28b4e0b251c199
Author: James Cherti <60946298+jamescherti@users.noreply.github.com>
Date: Mon Mar 14 20:24:51 2022 +0000
patch 8.2.4566: check for existing buffer in session file may not work
Problem: Check for existing buffer in session file does not work for files
in the home directory.
Solution: Use fnamemodify(). (James Cherti, closes #9945) Add a test.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Mar 2022 21:30:02 +0100 |
parents | 4fd87205ca80 |
children | 800e7de2f96d |
comparison
equal
deleted
inserted
replaced
28082:49854e230525 | 28083:f1c00b8085f6 |
---|---|
243 mksession! Xtest_mks.out | 243 mksession! Xtest_mks.out |
244 let lines = readfile('Xtest_mks.out') | 244 let lines = readfile('Xtest_mks.out') |
245 let count1 = 0 | 245 let count1 = 0 |
246 let count2 = 0 | 246 let count2 = 0 |
247 let count2buf = 0 | 247 let count2buf = 0 |
248 let bufexists = 0 | |
248 for line in lines | 249 for line in lines |
249 if line =~ 'edit \f*Xtest1$' | 250 if line =~ 'edit \f*Xtest1$' |
250 let count1 += 1 | 251 let count1 += 1 |
251 endif | 252 endif |
252 if line =~ 'edit \f\{-}Xtest2' | 253 if line =~ 'edit \f\{-}Xtest2' |
253 let count2 += 1 | 254 let count2 += 1 |
254 endif | 255 endif |
255 if line =~ 'buffer \f\{-}Xtest2' | 256 if line =~ 'buffer \f\{-}Xtest2' |
256 let count2buf += 1 | 257 let count2buf += 1 |
258 endif | |
259 if line =~ 'bufexists(fnamemodify(.*, ":p")' | |
260 let bufexists += 1 | |
257 endif | 261 endif |
258 endfor | 262 endfor |
259 call assert_equal(1, count1, 'Xtest1 count') | 263 call assert_equal(1, count1, 'Xtest1 count') |
260 call assert_equal(2, count2, 'Xtest2 count') | 264 call assert_equal(2, count2, 'Xtest2 count') |
261 call assert_equal(2, count2buf, 'Xtest2 buffer count') | 265 call assert_equal(2, count2buf, 'Xtest2 buffer count') |
266 call assert_equal(2, bufexists) | |
262 | 267 |
263 close | 268 close |
264 bwipe! | 269 bwipe! |
265 call delete('Xtest_mks.out') | 270 call delete('Xtest_mks.out') |
266 endfunc | 271 endfunc |