]> granicus.if.org Git - vim/commitdiff
patch 9.0.1339: no test for :disassemble with class function v9.0.1339
authorBram Moolenaar <Bram@vim.org>
Tue, 21 Feb 2023 20:09:46 +0000 (20:09 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 21 Feb 2023 20:09:46 +0000 (20:09 +0000)
Problem:    No test for :disassemble with class function.
Solution:   Add a test.

src/testdir/test_vim9_disassemble.vim
src/version.c

index 1433bb7690dc5dbcb25c680674d2e380106b3752..6f6879841608c2418c9c189e67c707243b114bdb 100644 (file)
@@ -3006,4 +3006,44 @@ def Test_disassemble_defer()
         instr)
 enddef
 
+def Test_disassemble_class_function()
+  var lines =<< trim END
+      vim9script
+
+      class Cl
+          static def Fc(): string
+            return "x"
+          enddef
+      endclass
+
+      g:instr = execute('disassemble Cl.Fc')
+  END
+  v9.CheckScriptSuccess(lines)
+  assert_match('Fc\_s*' ..
+        'return "x"\_s*' ..
+        '\d PUSHS "x"\_s*' ..
+        '\d RETURN\_s*',
+        g:instr)
+
+  lines =<< trim END
+      vim9script
+
+      class Cl
+          def Fo(): string
+            return "y"
+          enddef
+      endclass
+
+      g:instr = execute('disassemble Cl.Fo')
+  END
+  v9.CheckScriptSuccess(lines)
+  assert_match('Fo\_s*' ..
+        'return "y"\_s*' ..
+        '\d PUSHS "y"\_s*' ..
+        '\d RETURN\_s*',
+        g:instr)
+
+  unlet g:instr
+enddef
+
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index 6b8e2bc761b42705d2e06e2f1c60c41da3dd2720..12e5fa107a6e4f7cbc7944f612ccfd54320c4334 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1339,
 /**/
     1338,
 /**/