From 85e3f24bea649acfb962bd04ba922b9cf616d272 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 31 Jan 2025 17:02:32 +0100 Subject: [PATCH] patch 9.1.1061: tests: test_glvs fails when unarchiver not available Problem: tests: test_glvs fails when unarchiver not available (Brian L. Matthews) Solution: Check if an unarchiver is available, skip the test otherwise Signed-off-by: Christian Brabandt --- src/testdir/test_glvs.vim | 112 +++++++++++++++++++++++--------------- src/version.c | 2 + 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/src/testdir/test_glvs.vim b/src/testdir/test_glvs.vim index 765f8b5efb..1970826ce6 100644 --- a/src/testdir/test_glvs.vim +++ b/src/testdir/test_glvs.vim @@ -50,46 +50,76 @@ func SetUp() " (instead of relying on autoload) because set up depends on shell selection runtime plugin/vimballPlugin.vim runtime plugin/getscriptPlugin.vim +endfunc +func CheckTool(tool) " define tools location if has('win32') - if executable('git') let git_path = trim(system('powershell -Command "Split-Path (Split-Path (gcm git).Source)"')) endif - if executable('bunzip2') - let g:GetLatestVimScripts_bunzip2= "bunzip2" - elseif executable('7z') - let g:GetLatestVimScripts_bunzip2= "7z x" - elseif exists('git_path') - let g:GetLatestVimScripts_bunzip2= $'{git_path}\usr\bin\bunzip2' - else - call assert_report("Missing tool to decompress .bz2 files") + if a:tool == 'bunzip2' + if executable('bunzip2') + let g:GetLatestVimScripts_bunzip2= "bunzip2" + elseif executable('7z') + let g:GetLatestVimScripts_bunzip2= "7z x" + elseif exists('git_path') + let g:GetLatestVimScripts_bunzip2= $'{git_path}\usr\bin\bunzip2' + else + throw "Skipped: Missing tool to decompress .bz2 files" + endif endif - if executable('gunzip') - let g:GetLatestVimScripts_gunzip= "gunzip" - elseif executable('7z') - let g:GetLatestVimScripts_gunzip="7z e" - elseif exists('git_path') - let g:GetLatestVimScripts_gunzip= $'{git_path}\usr\bin\gunzip' - else - call assert_report("Missing tool to decompress .gz files") + if a:tool == 'gunzip' + if executable('gunzip') + let g:GetLatestVimScripts_gunzip= "gunzip" + elseif executable('7z') + let g:GetLatestVimScripts_gunzip="7z e" + elseif exists('git_path') + let g:GetLatestVimScripts_gunzip= $'{git_path}\usr\bin\gunzip' + else + throw "Skipped: Missing tool to decompress .gz files" + endif endif - if executable('unxz') - let g:GetLatestVimScripts_unxz= "unxz" - elseif executable('7z') - let g:GetLatestVimScripts_unxz="7z x" - elseif exists('git_path') - let g:GetLatestVimScripts_unxz= $'{git_path}\mingw64\bin\unxz' - else - call assert_report("Missing tool to decompress .xz files") + if a:tool == 'unxz' + if executable('unxz') + let g:GetLatestVimScripts_unxz= "unxz" + elseif executable('7z') + let g:GetLatestVimScripts_unxz="7z x" + elseif exists('git_path') + let g:GetLatestVimScripts_unxz= $'{git_path}\mingw64\bin\unxz' + else + throw "Skipped: Missing tool to decompress .xz files" + endif + endif + else + " Mac or Unix + if a:tool == 'bunzip2' + if executable('bunzip2') + let g:GetLatestVimScripts_bunzip2= "bunzip2" + else + throw "Skipped: Missing tool to decompress .bz2 files" + endif endif - endif + if a:tool == 'gunzip' + if executable('gunzip') + let g:GetLatestVimScripts_gunzip= "gunzip" + else + throw "Skipped: Missing tool to decompress .bz2 files" + endif + endif + if a:tool == 'unxz' + if executable('unxz') + let g:GetLatestVimScripts_unxz= "unxz" + else + throw "Skipped: Missing tool to decompress .xz files" + endif + endif + endif endfunc " After each test remove the contents of the .vim dir and reset the script @@ -110,7 +140,6 @@ endfunc " Ancillary functions func SetShell(shell) - " select different shells if a:shell == "default" set shell& shellcmdflag& shellxquote& shellpipe& shellredir& @@ -138,11 +167,9 @@ func SetShell(shell) " reload script to force new shell options runtime autoload/getscript.vim - endfunc func SelectScript(package) - " add the corresponding file exe $"split {s:scriptdir}/GetLatestVimScripts.dat" let scripts =<< trim END @@ -153,7 +180,6 @@ func SelectScript(package) call append(line('$'), s:packages[a:package]['spec']) w! bwipe! - endfunc func ValidateInstall(package) @@ -176,7 +202,6 @@ endfunc " Tests " func Test_glvs_default_vmb() - " select different shells call SetShell('default') @@ -187,11 +212,9 @@ func Test_glvs_default_vmb() GLVS call ValidateInstall('vmb') - endfunc func Test_glvs_pwsh_vmb() - " select different shells call SetShell('pwsh') @@ -202,11 +225,9 @@ func Test_glvs_pwsh_vmb() GLVS call ValidateInstall('vmb') - endfunc func Test_glvs_powershell_vmb() - " select different shells call SetShell('powershell') @@ -217,10 +238,10 @@ func Test_glvs_powershell_vmb() GLVS call ValidateInstall('vmb') - endfunc func Test_glvs_default_vim_bz2() + call CheckTool('bunzip2') " select different shells call SetShell('default') @@ -232,10 +253,10 @@ func Test_glvs_default_vim_bz2() GLVS call ValidateInstall('vim.bz2') - endfunc func Test_glvs_powershell_vim_bz2() + call CheckTool('bunzip2') " select different shells call SetShell('powershell') @@ -247,10 +268,10 @@ func Test_glvs_powershell_vim_bz2() GLVS call ValidateInstall('vim.bz2') - endfunc func Test_glvs_pwsh_vim_bz2() + call CheckTool('bunzip2') " select different shells call SetShell('pwsh') @@ -262,10 +283,10 @@ func Test_glvs_pwsh_vim_bz2() GLVS call ValidateInstall('vim.bz2') - endfunc func Test_glvs_default_vba_gz() + call CheckTool('gunzip') " select different shells call SetShell('default') @@ -277,10 +298,10 @@ func Test_glvs_default_vba_gz() GLVS call ValidateInstall('vba.gz') - endfunc func Test_glvs_powershell_vba_gz() + call CheckTool('gunzip') " select different shells call SetShell('powershell') @@ -292,10 +313,10 @@ func Test_glvs_powershell_vba_gz() GLVS call ValidateInstall('vba.gz') - endfunc func Test_glvs_pwsh_vba_gz() + call CheckTool('gunzip') " select different shells call SetShell('pwsh') @@ -307,10 +328,10 @@ func Test_glvs_pwsh_vba_gz() GLVS call ValidateInstall('vba.gz') - endfunc func Test_glvs_default_tar_xz() + call CheckTool('unxz') " select different shells call SetShell('default') @@ -322,10 +343,10 @@ func Test_glvs_default_tar_xz() GLVS call ValidateInstall('tar.xz') - endfunc func Test_glvs_powershell_tar_xz() + call CheckTool('unxz') " select different shells call SetShell('powershell') @@ -337,10 +358,10 @@ func Test_glvs_powershell_tar_xz() GLVS call ValidateInstall('tar.xz') - endfunc func Test_glvs_pwsh_tar_xz() + call CheckTool('unxz') " select different shells call SetShell('pwsh') @@ -352,5 +373,6 @@ func Test_glvs_pwsh_tar_xz() GLVS call ValidateInstall('tar.xz') - endfunc + +" vim: set sw=4 ts=4 et: diff --git a/src/version.c b/src/version.c index 1e0d3cda8b..b384a7398e 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1061, /**/ 1060, /**/ -- 2.47.2