From 9d383f30bbd06552ad0bf343b2c03c6a0d1f6df2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 14 May 2023 21:38:12 +0100 Subject: patch 9.0.1557: test failures for unreachable code Problem: Test failures for unreachable code. Solution: Add a test override to ignore unreachable code. --- runtime/doc/testing.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index 26f1a8f9e..97faea046 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -369,6 +369,7 @@ test_override({name}, {val}) *test_override()* string is detected ui_delay time in msec to use in ui_delay(); overrules a wait time of up to 3 seconds for messages + unreachable no error for code after `:throw` and `:return` uptime overrules sysinfo.uptime vterm_title setting the window title by a job running in a terminal window @@ -378,13 +379,18 @@ test_override({name}, {val}) *test_override()* "starting" is to be used when a test should behave like startup was done. Since the tests are run by sourcing a script the "starting" variable is non-zero. This is usually a - good thing (tests run faster), but sometimes changes behavior - in a way that the test doesn't work properly. + good thing (tests run faster), but sometimes this changes + behavior in a way that the test doesn't work properly. When using: > call test_override('starting', 1) < The value of "starting" is saved. It is restored by: > call test_override('starting', 0) +< To make sure the flag is reset later using `:defer` can be + useful: > + call test_override('unreachable', 1) + defer call test_override('unreachable', 0) + < Can also be used as a |method|: > GetOverrideVal()-> test_override('starting') -- cgit v1.2.1