diff src/testdir/test_debugger.vim @ 24918:f11779c1d123 v8.2.2996

patch 8.2.2996: Vim9: when debugging cannot inspect local variables Commit: https://github.com/vim/vim/commit/b69c6fb7b423ddc4578b093cb19257cad459dfae Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 14 20:40:37 2021 +0200 patch 8.2.2996: Vim9: when debugging cannot inspect local variables Problem: Vim9: when debugging cannot inspect local variables. Solution: Make local variables available when debugging.
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Jun 2021 20:45:03 +0200
parents e61a2085c89b
children afaa7f3aae56
line wrap: on
line diff
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -853,6 +853,7 @@ func Test_Backtrace_DefFunction()
     enddef
 
     def g:GlobalFunction()
+      var some = "some var"
       CallAFunction()
     enddef
 
@@ -884,19 +885,21 @@ func Test_Backtrace_DefFunction()
                 \ ':debug call GlobalFunction()',
                 \ ['cmd: call GlobalFunction()'])
 
-  call RunDbgCmd(buf, 'step', ['line 1:   CallAFunction()'])
+  call RunDbgCmd(buf, 'step', ['line 1:   var some = "some var"'])
+  call RunDbgCmd(buf, 'step', ['line 2:   CallAFunction()'])
+  call RunDbgCmd(buf, 'echo some', ['some var'])
 
-  " FIXME: not quite right
   call RunDbgCmd(buf, 'backtrace', [
         \ '\V>backtrace',
         \ '\V->0 function GlobalFunction',
-        \ '\Vline 1:   CallAFunction()',
+        \ '\Vline 2:   CallAFunction()',
         \ ],
         \ #{match: 'pattern'})
 
   call RunDbgCmd(buf, 'step', ['line 1:   SourceAnotherFile()'])
   call RunDbgCmd(buf, 'step', ['line 1:   source Xtest2.vim'])
-  " FIXME: repeated line
+  " Repeated line, because we fist are in the compiled function before the
+  " EXEC and then in do_cmdline() before the :source command.
   call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
   call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
   call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
@@ -906,7 +909,7 @@ func Test_Backtrace_DefFunction()
   call RunDbgCmd(buf, 'step', ['line 14: File2Function()'])
   call RunDbgCmd(buf, 'backtrace', [
         \ '\V>backtrace',
-        \ '\V  3 function GlobalFunction[1]',
+        \ '\V  3 function GlobalFunction[2]',
         \ '\V  2 <SNR>\.\*_CallAFunction[1]',
         \ '\V  1 <SNR>\.\*_SourceAnotherFile[1]',
         \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
@@ -917,7 +920,7 @@ func Test_Backtrace_DefFunction()
   call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
   call RunDbgCmd(buf, 'backtrace', [
         \ '\V>backtrace',
-        \ '\V  3 function GlobalFunction[1]',
+        \ '\V  3 function GlobalFunction[2]',
         \ '\V  2 <SNR>\.\*_CallAFunction[1]',
         \ '\V  1 <SNR>\.\*_SourceAnotherFile[1]',
         \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',