From c758423cf215fde45eb6cb94e683fdecf3e0b9c3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 4 Dec 2025 11:31:09 +0800 Subject: [PATCH] vim-patch:9.1.1951: tests: Test_windows_external_cmd_in_cwd() only run in huge builds Problem: tests: Test_windows_external_cmd_in_cwd() is only run in huge builds (after 9.1.1947). Solution: Move it to test_system.vim so that it is run in normal builds. closes: vim/vim#18853 https://github.com/vim/vim/commit/2c164f02c664b1b6d4743047914c53b0aea07161 --- test/old/testdir/test_system.vim | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/old/testdir/test_system.vim b/test/old/testdir/test_system.vim index 30fab6d55f..a9086d1bdf 100644 --- a/test/old/testdir/test_system.vim +++ b/test/old/testdir/test_system.vim @@ -141,4 +141,42 @@ func Test_system_with_shell_quote() endtry endfunc +" Check that Vim does not execute anything from current directory +func Test_windows_external_cmd_in_cwd() + CheckMSWindows + + " just in case + call system('rd /S /Q Xfolder') + call mkdir('Xfolder', 'R') + cd Xfolder + + let contents = ['@echo off', 'echo filename1.txt:1:AAAA'] + call writefile(contents, 'findstr.cmd') + + let file1 = ['AAAA', 'THIS FILE SHOULD NOT BE FOUND'] + let file2 = ['BBBB', 'THIS FILE SHOULD BE FOUND'] + + call writefile(file1, 'filename1.txt') + call writefile(file2, 'filename2.txt') + + if has('quickfix') + " use silent to avoid hit-enter-prompt + sil grep BBBB filename*.txt + call assert_equal('filename2.txt', @%) + endif + + let output = system('findstr BBBB filename*') + " Match trailing newline byte + call assert_match('filename2.txt:BBBB.', output) + + if has('gui') + set guioptions+=! + let output = system('findstr BBBB filename*') + call assert_match('filename2.txt:BBBB.', output) + endif + + cd - + set guioptions& +endfunc + " vim: shiftwidth=2 sts=2 expandtab