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 #10311)
diff --git a/src/testdir/test_expand_func.vim b/src/testdir/test_expand_func.vim
index 59156af..d9327bf 100644
--- a/src/testdir/test_expand_func.vim
+++ b/src/testdir/test_expand_func.vim
@@ -82,7 +82,7 @@
func Test_expand()
new
- call assert_equal("''", expand('%:S'))
+ call assert_equal("", expand('%:S'))
call assert_equal('3', '<slnum>'->expand())
call assert_equal(['4'], expand('<slnum>', v:false, v:true))
" Don't add any line above this, otherwise <slnum> will change.
@@ -90,6 +90,7 @@
set verbose=1
call assert_equal("", expand('%'))
set verbose=0
+ call assert_equal("", expand('%:p'))
quit
endfunc