From 5c69f8569ad2013b1d97afd2fbefd6bda8e8379f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Nov 2023 08:57:55 +0800 Subject: vim-patch:9.0.0137: debugger test may fail when $CWD is very long Problem: Debugger test may fail when $CWD is very long. Solution: Skip the test if the directory name is too long. (James McCoy, closes vim/vim#10837) https://github.com/vim/vim/commit/db7a88db8b52508d3df6d5947f7c4f3ef05d5f62 Co-authored-by: James McCoy --- test/old/testdir/test_debugger.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir/test_debugger.vim') diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim index 7ac45a0bd4..f6b186d090 100644 --- a/test/old/testdir/test_debugger.vim +++ b/test/old/testdir/test_debugger.vim @@ -366,6 +366,8 @@ endfunc " Test for expression breakpoint set using ":breakadd expr " func Test_Debugger_breakadd_expr() CheckRunVimInTerminal + CheckCWD + let lines =<< trim END let g:Xtest_var += 1 END -- cgit From 629f117945231497ce04ce5a0628c0999807725f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Nov 2023 08:58:58 +0800 Subject: vim-patch:9.0.0525: manually deleting temp test files Problem: Manually deleting temp test files. Solution: Add the 'D' flag to writefile(). https://github.com/vim/vim/commit/5917341f65d4fc669b9d15343ccdb00c160201da Co-authored-by: Bram Moolenaar --- test/old/testdir/test_debugger.vim | 68 +++++++++++++++----------------------- 1 file changed, 26 insertions(+), 42 deletions(-) (limited to 'test/old/testdir/test_debugger.vim') diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim index f6b186d090..ad03443cb4 100644 --- a/test/old/testdir/test_debugger.vim +++ b/test/old/testdir/test_debugger.vim @@ -81,10 +81,10 @@ func Test_Debugger() endfor enddef END - call writefile(lines, 'Xtest.vim') + call writefile(lines, 'XtestDebug.vim', 'D') " Start Vim in a terminal - let buf = RunVimInTerminal('-S Xtest.vim', {}) + let buf = RunVimInTerminal('-S XtestDebug.vim', {}) " Start the Vim debugger call RunDbgCmd(buf, ':debug echo Foo()', ['cmd: echo Foo()']) @@ -344,19 +344,18 @@ func Test_Debugger_breakadd() let var3 = 30 let var4 = 40 END - call writefile(lines, 'Xtest.vim') + call writefile(lines, 'XdebugBreakadd.vim', 'D') " Start Vim in a terminal - let buf = RunVimInTerminal('Xtest.vim', {}) - call RunDbgCmd(buf, ':breakadd file 2 Xtest.vim') + let buf = RunVimInTerminal('XdebugBreakadd.vim', {}) + call RunDbgCmd(buf, ':breakadd file 2 XdebugBreakadd.vim') call RunDbgCmd(buf, ':4 | breakadd here') - call RunDbgCmd(buf, ':source Xtest.vim', ['line 2: let var2 = 20']) + call RunDbgCmd(buf, ':source XdebugBreakadd.vim', ['line 2: let var2 = 20']) call RunDbgCmd(buf, 'cont', ['line 4: let var4 = 40']) call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) - call delete('Xtest.vim') %bw! call assert_fails('breakadd here', 'E32:') @@ -371,31 +370,30 @@ func Test_Debugger_breakadd_expr() let lines =<< trim END let g:Xtest_var += 1 END - call writefile(lines, 'Xtest.vim') + call writefile(lines, 'XdebugBreakExpr.vim', 'D') " Start Vim in a terminal - let buf = RunVimInTerminal('Xtest.vim', {}) + let buf = RunVimInTerminal('XdebugBreakExpr.vim', {}) call RunDbgCmd(buf, ':let g:Xtest_var = 10') call RunDbgCmd(buf, ':breakadd expr g:Xtest_var') call RunDbgCmd(buf, ':source %') - let expected =<< eval trim END + let expected =<< trim eval END Oldval = "10" Newval = "11" - {fnamemodify('Xtest.vim', ':p')} + {fnamemodify('XdebugBreakExpr.vim', ':p')} line 1: let g:Xtest_var += 1 END call RunDbgCmd(buf, ':source %', expected) call RunDbgCmd(buf, 'cont') - let expected =<< eval trim END + let expected =<< trim eval END Oldval = "11" Newval = "12" - {fnamemodify('Xtest.vim', ':p')} + {fnamemodify('XdebugBreakExpr.vim', ':p')} line 1: let g:Xtest_var += 1 END call RunDbgCmd(buf, ':source %', expected) call StopVimInTerminal(buf) - call delete('Xtest.vim') endfunc func Test_Backtrace_Through_Source() @@ -415,7 +413,7 @@ func Test_Backtrace_Through_Source() call CallAFunction() endfunc END - call writefile(file1, 'Xtest1.vim') + call writefile(file1, 'Xtest1.vim', 'D') let file2 =<< trim END func DoAThing() @@ -428,7 +426,7 @@ func Test_Backtrace_Through_Source() call File2Function() END - call writefile(file2, 'Xtest2.vim') + call writefile(file2, 'Xtest2.vim', 'D') let buf = RunVimInTerminal('-S Xtest1.vim', {}) @@ -570,8 +568,6 @@ func Test_Backtrace_Through_Source() \ 'line 1: call DoAThing()']) call StopVimInTerminal(buf) - call delete('Xtest1.vim') - call delete('Xtest2.vim') endfunc func Test_Backtrace_Autocmd() @@ -593,7 +589,7 @@ func Test_Backtrace_Autocmd() au User TestGlobalFunction :call GlobalFunction() | echo "Done" END - call writefile(file1, 'Xtest1.vim') + call writefile(file1, 'Xtest1.vim', 'D') let file2 =<< trim END func DoAThing() @@ -606,7 +602,7 @@ func Test_Backtrace_Autocmd() call File2Function() END - call writefile(file2, 'Xtest2.vim') + call writefile(file2, 'Xtest2.vim', 'D') let buf = RunVimInTerminal('-S Xtest1.vim', {}) @@ -826,8 +822,6 @@ func Test_Backtrace_Autocmd() \ 'cmd: echo "Done"']) call StopVimInTerminal(buf) - call delete('Xtest1.vim') - call delete('Xtest2.vim') endfunc func Test_Backtrace_CmdLine() @@ -849,7 +843,7 @@ func Test_Backtrace_CmdLine() au User TestGlobalFunction :call GlobalFunction() | echo "Done" END - call writefile(file1, 'Xtest1.vim') + call writefile(file1, 'Xtest1.vim', 'D') let file2 =<< trim END func DoAThing() @@ -862,7 +856,7 @@ func Test_Backtrace_CmdLine() call File2Function() END - call writefile(file2, 'Xtest2.vim') + call writefile(file2, 'Xtest2.vim', 'D') let buf = RunVimInTerminal( \ '-S Xtest1.vim -c "debug call GlobalFunction()"', @@ -888,8 +882,6 @@ func Test_Backtrace_CmdLine() \ 'line 1: call CallAFunction()']) call StopVimInTerminal(buf) - call delete('Xtest1.vim') - call delete('Xtest2.vim') endfunc func Test_Backtrace_DefFunction() @@ -915,7 +907,7 @@ func Test_Backtrace_DefFunction() defcompile END - call writefile(file1, 'Xtest1.vim') + call writefile(file1, 'Xtest1.vim', 'D') let file2 =<< trim END vim9script @@ -933,7 +925,7 @@ func Test_Backtrace_DefFunction() defcompile File2Function() END - call writefile(file2, 'Xtest2.vim') + call writefile(file2, 'Xtest2.vim', 'D') let buf = RunVimInTerminal('-S Xtest1.vim', {}) @@ -984,8 +976,6 @@ func Test_Backtrace_DefFunction() \ #{match: 'pattern'}) call StopVimInTerminal(buf) - call delete('Xtest1.vim') - call delete('Xtest2.vim') endfunc func Test_DefFunction_expr() @@ -1000,14 +990,13 @@ func Test_DefFunction_expr() enddef defcompile END - call writefile(file3, 'Xtest3.vim') + call writefile(file3, 'Xtest3.vim', 'D') let buf = RunVimInTerminal('-S Xtest3.vim', {}) call RunDbgCmd(buf, ':breakadd expr g:someVar') call RunDbgCmd(buf, ':call g:ChangeVar()', ['Oldval = "''foo''"', 'Newval = "''bar''"', 'function ChangeVar', 'line 2: echo "changed"']) call StopVimInTerminal(buf) - call delete('Xtest3.vim') endfunc func Test_debug_def_and_legacy_function() @@ -1037,7 +1026,7 @@ func Test_debug_def_and_legacy_function() breakadd func 2 g:SomeFunc END - call writefile(file, 'XtestDebug.vim') + call writefile(file, 'XtestDebug.vim', 'D') let buf = RunVimInTerminal('-S XtestDebug.vim', {}) @@ -1054,7 +1043,6 @@ func Test_debug_def_and_legacy_function() call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) - call delete('XtestDebug.vim') endfunc func Test_debug_def_function() @@ -1111,7 +1099,7 @@ func Test_debug_def_function() | eval 2 + 3 enddef END - call writefile(file, 'Xtest.vim') + call writefile(file, 'Xtest.vim', 'D') let buf = RunVimInTerminal('-S Xtest.vim', {}) @@ -1178,7 +1166,6 @@ func Test_debug_def_function() call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) - call delete('Xtest.vim') endfunc func Test_debug_def_function_with_lambda() @@ -1193,7 +1180,7 @@ func Test_debug_def_function_with_lambda() enddef breakadd func 2 g:Func END - call writefile(lines, 'XtestLambda.vim') + call writefile(lines, 'XtestLambda.vim', 'D') let buf = RunVimInTerminal('-S XtestLambda.vim', {}) @@ -1206,7 +1193,6 @@ func Test_debug_def_function_with_lambda() call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) - call delete('XtestLambda.vim') endfunc func Test_debug_backtrace_level() @@ -1225,7 +1211,7 @@ func Test_debug_backtrace_level() call s:File1Func( 'arg1' ) END - call writefile(lines, 'Xtest1.vim') + call writefile(lines, 'Xtest1.vim', 'D') let lines =<< trim END let s:file2_var = 'file2' @@ -1238,7 +1224,7 @@ func Test_debug_backtrace_level() call s:File2Func( 'arg2' ) END - call writefile(lines, 'Xtest2.vim') + call writefile(lines, 'Xtest2.vim', 'D') let file1 = getcwd() .. '/Xtest1.vim' let file2 = getcwd() .. '/Xtest2.vim' @@ -1399,8 +1385,6 @@ func Test_debug_backtrace_level() call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) - call delete('Xtest1.vim') - call delete('Xtest2.vim') endfunc " Test for setting a breakpoint on a :endif where the :if condition is false -- cgit