aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/old/testdir/test_stacktrace.vim20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/old/testdir/test_stacktrace.vim b/test/old/testdir/test_stacktrace.vim
index 1e47deefdd..9e1f51e1f6 100644
--- a/test/old/testdir/test_stacktrace.vim
+++ b/test/old/testdir/test_stacktrace.vim
@@ -10,7 +10,7 @@ func Filepath(name)
endfunc
func AssertStacktrace(expect, actual)
- call assert_equal(#{lnum: 581, filepath: Filepath('runtest.vim')}, a:actual[0])
+ call assert_equal(Filepath('runtest.vim'), a:actual[0]['filepath'])
call assert_equal(a:expect, a:actual[-len(a:expect):])
endfunc
@@ -97,6 +97,12 @@ func Test_vstacktrace()
call Xfunc1()
catch
let stacktrace = v:stacktrace
+ try
+ call Xfunc1()
+ catch
+ let stacktrace_inner = v:stacktrace
+ endtry
+ let stacktrace_after = v:stacktrace " should be restored by the exception stack to the previous one
endtry
call assert_equal([], v:stacktrace)
call AssertStacktrace([
@@ -104,9 +110,15 @@ func Test_vstacktrace()
\ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')},
\ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')},
\ ], stacktrace)
+ call AssertStacktrace([
+ \ #{funcref: funcref('Test_vstacktrace'), lnum: 101, filepath: s:thisfile},
+ \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')},
+ \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')},
+ \ ], stacktrace_inner)
+ call assert_equal(stacktrace, stacktrace_after)
endfunc
-func Test_zzz_stacktrace_vim9()
+func Test_stacktrace_vim9()
let lines =<< trim [SCRIPT]
var stacktrace = getstacktrace()
assert_notequal([], stacktrace)
@@ -122,11 +134,9 @@ func Test_zzz_stacktrace_vim9()
assert_true(has_key(d, 'lnum'))
endfor
endtry
+ call assert_equal([], v:stacktrace)
[SCRIPT]
call CheckDefSuccess(lines)
- " FIXME: v:stacktrace is not cleared after the exception handling, and this
- " test has to be run as the last one because of this.
- " call assert_equal([], v:stacktrace)
endfunc
" vim: shiftwidth=2 sts=2 expandtab