Mercurial > vim
comparison src/testdir/test_expand_func.vim @ 28637:5cf6dee0f305 v8.2.4842
patch 8.2.4842: expand("%:p") is not empty when there is no buffer name
Commit: https://github.com/vim/vim/commit/211a5bb2353c66684f38527184a258921f95c9d9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 28 19:09:03 2022 +0100
patch 8.2.4842: expand("%:p") is not empty when there is no buffer name
Problem: expand("%:p") is not empty when there is no buffer name.
Solution: When ignoring errors still return NULL. (closes https://github.com/vim/vim/issues/10311)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Apr 2022 20:15:03 +0200 |
parents | dfe18756f2ad |
children | 32f358d71ec2 |
comparison
equal
deleted
inserted
replaced
28636:ba9fa3a26a17 | 28637:5cf6dee0f305 |
---|---|
80 delcommand Slnum | 80 delcommand Slnum |
81 endfunc | 81 endfunc |
82 | 82 |
83 func Test_expand() | 83 func Test_expand() |
84 new | 84 new |
85 call assert_equal("''", expand('%:S')) | 85 call assert_equal("", expand('%:S')) |
86 call assert_equal('3', '<slnum>'->expand()) | 86 call assert_equal('3', '<slnum>'->expand()) |
87 call assert_equal(['4'], expand('<slnum>', v:false, v:true)) | 87 call assert_equal(['4'], expand('<slnum>', v:false, v:true)) |
88 " Don't add any line above this, otherwise <slnum> will change. | 88 " Don't add any line above this, otherwise <slnum> will change. |
89 call assert_equal("", expand('%')) | 89 call assert_equal("", expand('%')) |
90 set verbose=1 | 90 set verbose=1 |
91 call assert_equal("", expand('%')) | 91 call assert_equal("", expand('%')) |
92 set verbose=0 | 92 set verbose=0 |
93 call assert_equal("", expand('%:p')) | |
93 quit | 94 quit |
94 endfunc | 95 endfunc |
95 | 96 |
96 func s:sid_test() | 97 func s:sid_test() |
97 return 'works' | 98 return 'works' |