Mercurial > vim
comparison src/testdir/test_debugger.vim @ 24952:ffe784fdec57 v8.2.3013
patch 8.2.3013: Vim: when debugging only first line of command is displayed
Commit: https://github.com/vim/vim/commit/4cea536bdf48df459e7ad651dfee006844bbf2c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 16 22:24:40 2021 +0200
patch 8.2.3013: Vim: when debugging only first line of command is displayed
Problem: Vim: when debugging only the first line of a command using line
continuation is displayed.
Solution: Find the next command and concatenate lines until that one.
(closes #8392)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Jun 2021 22:30:03 +0200 |
parents | 5c418c774f95 |
children | 64b70a958f19 |
comparison
equal
deleted
inserted
replaced
24951:8972f6de0a40 | 24952:ffe784fdec57 |
---|---|
883 | 883 |
884 call RunDbgCmd(buf, | 884 call RunDbgCmd(buf, |
885 \ ':debug call GlobalFunction()', | 885 \ ':debug call GlobalFunction()', |
886 \ ['cmd: call GlobalFunction()']) | 886 \ ['cmd: call GlobalFunction()']) |
887 | 887 |
888 call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"']) | 888 call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"']) |
889 call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()']) | 889 call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()']) |
890 call RunDbgCmd(buf, 'echo some', ['some var']) | 890 call RunDbgCmd(buf, 'echo some', ['some var']) |
891 | 891 |
892 call RunDbgCmd(buf, 'backtrace', [ | 892 call RunDbgCmd(buf, 'backtrace', [ |
893 \ '\V>backtrace', | 893 \ '\V>backtrace', |
894 \ '\V->0 function GlobalFunction', | 894 \ '\V->0 function GlobalFunction', |
895 \ '\Vline 2: CallAFunction()', | 895 \ '\Vline 2: CallAFunction()', |
896 \ ], | 896 \ ], |
897 \ #{match: 'pattern'}) | 897 \ #{match: 'pattern'}) |
898 | 898 |
899 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()']) | 899 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()']) |
900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) | 900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) |
901 " Repeated line, because we fist are in the compiled function before the | 901 " Repeated line, because we fist are in the compiled function before the |
902 " EXEC and then in do_cmdline() before the :source command. | 902 " EXEC and then in do_cmdline() before the :source command. |
903 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) | 903 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) |
904 call RunDbgCmd(buf, 'step', ['line 1: vim9script']) | 904 call RunDbgCmd(buf, 'step', ['line 1: vim9script']) |
905 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number']) | 905 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number']) |
950 for it in items | 950 for it in items |
951 echo it | 951 echo it |
952 endfor | 952 endfor |
953 echo "done" | 953 echo "done" |
954 enddef | 954 enddef |
955 | |
956 def g:FuncWithDict() | |
957 var d = { | |
958 a: 1, | |
959 b: 2, | |
960 } | |
961 enddef | |
955 END | 962 END |
956 call writefile(file, 'Xtest.vim') | 963 call writefile(file, 'Xtest.vim') |
957 | 964 |
958 let buf = RunVimInTerminal('-S Xtest.vim', {}) | 965 let buf = RunVimInTerminal('-S Xtest.vim', {}) |
959 | 966 |
965 call RunDbgCmd(buf, 'cont') | 972 call RunDbgCmd(buf, 'cont') |
966 | 973 |
967 call RunDbgCmd(buf, | 974 call RunDbgCmd(buf, |
968 \ ':debug call FuncWithArgs("asdf", 42, 1, 2, 3)', | 975 \ ':debug call FuncWithArgs("asdf", 42, 1, 2, 3)', |
969 \ ['cmd: call FuncWithArgs("asdf", 42, 1, 2, 3)']) | 976 \ ['cmd: call FuncWithArgs("asdf", 42, 1, 2, 3)']) |
970 call RunDbgCmd(buf, 'step', ['line 1: echo text .. nr']) | 977 call RunDbgCmd(buf, 'step', ['line 1: echo text .. nr']) |
971 call RunDbgCmd(buf, 'echo text', ['asdf']) | 978 call RunDbgCmd(buf, 'echo text', ['asdf']) |
972 call RunDbgCmd(buf, 'echo nr', ['42']) | 979 call RunDbgCmd(buf, 'echo nr', ['42']) |
973 call RunDbgCmd(buf, 'echo items', ['[1, 2, 3]']) | 980 call RunDbgCmd(buf, 'echo items', ['[1, 2, 3]']) |
974 call RunDbgCmd(buf, 'step', ['asdf42', 'function FuncWithArgs', 'line 2: for it in items']) | 981 call RunDbgCmd(buf, 'step', ['asdf42', 'function FuncWithArgs', 'line 2: for it in items']) |
975 call RunDbgCmd(buf, 'echo it', ['1']) | 982 call RunDbgCmd(buf, 'echo it', ['1']) |
976 call RunDbgCmd(buf, 'step', ['line 3: echo it']) | 983 call RunDbgCmd(buf, 'step', ['line 3: echo it']) |
977 call RunDbgCmd(buf, 'step', ['1', 'function FuncWithArgs', 'line 4: endfor']) | 984 call RunDbgCmd(buf, 'step', ['1', 'function FuncWithArgs', 'line 4: endfor']) |
978 call RunDbgCmd(buf, 'step', ['line 2: for it in items']) | 985 call RunDbgCmd(buf, 'step', ['line 2: for it in items']) |
979 call RunDbgCmd(buf, 'echo it', ['2']) | 986 call RunDbgCmd(buf, 'echo it', ['2']) |
980 call RunDbgCmd(buf, 'step', ['line 3: echo it']) | 987 call RunDbgCmd(buf, 'step', ['line 3: echo it']) |
981 call RunDbgCmd(buf, 'step', ['2', 'function FuncWithArgs', 'line 4: endfor']) | 988 call RunDbgCmd(buf, 'step', ['2', 'function FuncWithArgs', 'line 4: endfor']) |
982 call RunDbgCmd(buf, 'step', ['line 2: for it in items']) | 989 call RunDbgCmd(buf, 'step', ['line 2: for it in items']) |
983 call RunDbgCmd(buf, 'echo it', ['3']) | 990 call RunDbgCmd(buf, 'echo it', ['3']) |
984 call RunDbgCmd(buf, 'step', ['line 3: echo it']) | 991 call RunDbgCmd(buf, 'step', ['line 3: echo it']) |
985 call RunDbgCmd(buf, 'step', ['3', 'function FuncWithArgs', 'line 4: endfor']) | 992 call RunDbgCmd(buf, 'step', ['3', 'function FuncWithArgs', 'line 4: endfor']) |
986 call RunDbgCmd(buf, 'step', ['line 5: echo "done"']) | 993 call RunDbgCmd(buf, 'step', ['line 5: echo "done"']) |
994 call RunDbgCmd(buf, 'cont') | |
995 | |
996 call RunDbgCmd(buf, | |
997 \ ':debug call FuncWithDict()', | |
998 \ ['cmd: call FuncWithDict()']) | |
999 call RunDbgCmd(buf, 'step', ['line 1: var d = { a: 1, b: 2, }']) | |
987 | 1000 |
988 call RunDbgCmd(buf, 'cont') | 1001 call RunDbgCmd(buf, 'cont') |
989 call StopVimInTerminal(buf) | 1002 call StopVimInTerminal(buf) |
990 call delete('Xtest.vim') | 1003 call delete('Xtest.vim') |
991 endfunc | 1004 endfunc |