Mercurial > vim
diff runtime/doc/testing.txt @ 22163:b6d36f0b4f03 v8.2.1631
patch 8.2.1631: test_fails() does not check the context of the line number
Commit: https://github.com/vim/vim/commit/9bd5d879c2ecfbdbb168b090e12f4b89724a302e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 6 21:47:48 2020 +0200
patch 8.2.1631: test_fails() does not check the context of the line number
Problem: test_fails() does not check the context of the line number.
Solution: Use another argument to specify the context of the line number.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Sep 2020 22:00:03 +0200 |
parents | bbca88cd13d5 |
children | d4c7b3e9cd17 |
line wrap: on
line diff
--- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -293,7 +293,7 @@ assert_exception({error} [, {msg}]) *a endtry < *assert_fails()* -assert_fails({cmd} [, {error} [, {msg} [, {lnum}]]]) +assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) Run {cmd} and add an error message to |v:errors| if it does NOT produce an error or when {error} is not found in the error message. Also see |assert-return|. @@ -320,6 +320,10 @@ assert_fails({cmd} [, {error} [, {msg} [ the line number at which the error was reported. That can be the line number in a function or in a script. + When {context} is present it is used as a pattern and matched + against the context (script name or function name) where + {lnum} is located in. + Note that beeping is not considered an error, and some failing commands only beep. Use |assert_beeps()| for those.