Mercurial > vim
changeset 27106:d7e6b85dd89d v8.2.4082
patch 8.2.4082: check for autoload file name and prefix fails
Commit: https://github.com/vim/vim/commit/3049fcf0a189b0fea8468fa308887b8252d93dce
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 13 19:25:50 2022 +0000
patch 8.2.4082: check for autoload file name and prefix fails
Problem: Check for autoload file name and prefix fails. (Christian J.
Robinson)
Solution: Only lower case the prefix on systems where the file name is not
case sensitive.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Jan 2022 20:30:06 +0100 |
parents | dae3c23512fb |
children | 6318e5d19095 |
files | src/scriptfile.c src/testdir/test_vim9_import.vim src/version.c |
diffstat | 3 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -2156,7 +2156,11 @@ get_autoload_prefix(scriptitem_T *si) if (p == NULL) return NULL; +#ifdef CASE_INSENSITIVE_FILENAME prefix = strlow_save(p); +#else + prefix = vim_strsave(p); +#endif if (prefix == NULL) return NULL;
--- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -1375,6 +1375,31 @@ def Test_vim9_aucmd_autoload() &rtp = save_rtp enddef +" test using a autoloaded file that is case sensitive +def Test_vim9_autoload_case_sensitive() + var lines =<< trim END + vim9script autoload + export def CaseSensitive(): string + return 'done' + enddef + END + + mkdir('Xdir/autoload', 'p') + writefile(lines, 'Xdir/autoload/CaseSensitive.vim') + var save_rtp = &rtp + exe 'set rtp^=' .. getcwd() .. '/Xdir' + + lines =<< trim END + vim9script + import autoload 'CaseSensitive.vim' + assert_equal('done', CaseSensitive.CaseSensitive()) + END + CheckScriptSuccess(lines) + + delete('Xdir', 'rf') + &rtp = save_rtp +enddef + " This was causing a crash because suppress_errthrow wasn't reset. def Test_vim9_autoload_error() var lines =<< trim END