patch 8.2.4597: LuaV_debug() not covered by tests v8.2.4597
authorDominique Pelle <dominique.pelle@gmail.com>
Sun, 20 Mar 2022 11:46:01 +0000 (11:46 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 20 Mar 2022 11:46:01 +0000 (11:46 +0000)
Problem:    LuaV_debug() not covered by tests.
Solution:   Add a test. (Dominique Pellé, closes #9980)

src/testdir/test_lua.vim
src/version.c

index fd265ef431edb5f7e1300afeaa9b67a3b3f7b48b..1f2df109495992c83f769487b18b22ef305ee7e3 100644 (file)
@@ -1192,4 +1192,27 @@ func Test_lua_multiple_commands()
   augroup! Luagroup
 endfunc
 
+func Test_lua_debug()
+  CheckRunVimInTerminal
+
+  let buf = RunVimInTerminal('', {'rows': 10})
+  call term_sendkeys(buf, ":lua debug.debug()\n")
+  call WaitForAssert({-> assert_equal('lua_debug> ', term_getline(buf, 10))})
+
+  call term_sendkeys(buf, "foo = 42\n")
+  call WaitForAssert({-> assert_equal('lua_debug> foo = 42', term_getline(buf, 9))})
+  call WaitForAssert({-> assert_equal('lua_debug> ',         term_getline(buf, 10))})
+
+  call term_sendkeys(buf, "print(foo)\n")
+  call WaitForAssert({-> assert_equal('lua_debug> print(foo)', term_getline(buf, 8))})
+  call WaitForAssert({-> assert_equal('42',                    term_getline(buf, 9))})
+  call WaitForAssert({-> assert_equal('lua_debug> ',           term_getline(buf, 10))})
+
+  call term_sendkeys(buf, "cont\n")
+  call WaitForAssert({-> assert_match(' All$', term_getline(buf, 10))})
+
+  call StopVimInTerminal(buf)
+  call delete('XtestLuaDebug.vim')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index c101728a91772771b7e2acdf01aed41a3a53d95a..02bd4973a874cfd8401aaebdf1259e3f27eac5fb 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4597,
 /**/
     4596,
 /**/