diff options
| author | Michael Albinus | 2025-02-10 11:30:32 +0100 |
|---|---|---|
| committer | Michael Albinus | 2025-02-10 11:30:32 +0100 |
| commit | b92cfadc6af3abf773f666bedc571bb85402b001 (patch) | |
| tree | 7ca092bf18ddfa6e82ff150c94a81e1340922a67 /doc | |
| parent | efa9b97b454d2bf56d50fb4ef37e8378bb2e4b2a (diff) | |
| download | emacs-b92cfadc6af3abf773f666bedc571bb85402b001.tar.gz emacs-b92cfadc6af3abf773f666bedc571bb85402b001.zip | |
* doc/misc/ert.texi (Helper Functions): Improve index. Fix markups.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/ert.texi | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 35128fcfeb0..566fa03bf3f 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi | |||
| @@ -1107,8 +1107,8 @@ result of @var{NAME-FORM}. Example: | |||
| 1107 | @dots{})) | 1107 | @dots{})) |
| 1108 | @end lisp | 1108 | @end lisp |
| 1109 | 1109 | ||
| 1110 | This uses the test buffer @t{"*Test buffer (backtrace-tests--variables): | 1110 | This uses the test buffer @file{*Test buffer |
| 1111 | variables*"}. | 1111 | (backtrace-tests--variables): variables*}. |
| 1112 | @end defmac | 1112 | @end defmac |
| 1113 | 1113 | ||
| 1114 | @defmac ert-with-buffer-selected (buffer &body body) | 1114 | @defmac ert-with-buffer-selected (buffer &body body) |
| @@ -1130,7 +1130,7 @@ value is the last form in @var{body}. Example: | |||
| 1130 | @dots{})) | 1130 | @dots{})) |
| 1131 | @end lisp | 1131 | @end lisp |
| 1132 | 1132 | ||
| 1133 | This displays a temporary buffer @t{" *temp*-739785"*}. | 1133 | This displays a temporary buffer like @file{ *temp*-739785*}. |
| 1134 | @end defmac | 1134 | @end defmac |
| 1135 | 1135 | ||
| 1136 | @defmac ert-with-test-buffer-selected ((&key name) &body body) | 1136 | @defmac ert-with-test-buffer-selected ((&key name) &body body) |
| @@ -1146,8 +1146,8 @@ It combines @code{ert-with-test-buffer} and | |||
| 1146 | @dots{})) | 1146 | @dots{})) |
| 1147 | @end lisp | 1147 | @end lisp |
| 1148 | 1148 | ||
| 1149 | This displays the test buffer @t{"*Test buffer | 1149 | This displays the test buffer @file{*Test buffer |
| 1150 | (whitespace-tests--global): global*"}. | 1150 | (whitespace-tests--global): global*}. |
| 1151 | @end defmac | 1151 | @end defmac |
| 1152 | 1152 | ||
| 1153 | @defun ert-kill-all-test-buffers () | 1153 | @defun ert-kill-all-test-buffers () |
| @@ -1162,7 +1162,7 @@ temporary name, creates a new buffer named @var{buffer-name}, executes | |||
| 1162 | to @var{buffer-name}. | 1162 | to @var{buffer-name}. |
| 1163 | 1163 | ||
| 1164 | This is useful if @var{body} has undesirable side-effects on an Emacs | 1164 | This is useful if @var{body} has undesirable side-effects on an Emacs |
| 1165 | buffer with a fixed name such as @t{"*Messages*"}. Example: | 1165 | buffer with a fixed name such as @file{*Messages*}. Example: |
| 1166 | 1166 | ||
| 1167 | @lisp | 1167 | @lisp |
| 1168 | (ert-with-buffer-renamed ("*Messages*") @dots{}) | 1168 | (ert-with-buffer-renamed ("*Messages*") @dots{}) |
| @@ -1178,7 +1178,7 @@ and @code{princ} to the echo area. Messages issued from C code using | |||
| 1178 | the above mentioned functions will not be captured. | 1178 | the above mentioned functions will not be captured. |
| 1179 | 1179 | ||
| 1180 | This is useful for separating the issuance of messages by the code under | 1180 | This is useful for separating the issuance of messages by the code under |
| 1181 | test from the behavior of the @t{"*Messages*"} buffer. Example: | 1181 | test from the behavior of the @file{*Messages*} buffer. Example: |
| 1182 | 1182 | ||
| 1183 | @lisp | 1183 | @lisp |
| 1184 | (ert-with-message-capture captured-messages @dots{}) | 1184 | (ert-with-message-capture captured-messages @dots{}) |
| @@ -1193,14 +1193,17 @@ The path to the resource directory is the @file{resources} directory in | |||
| 1193 | the same directory as the test file this is called from. | 1193 | the same directory as the test file this is called from. |
| 1194 | 1194 | ||
| 1195 | If that directory doesn't exist, find a directory based on the test file | 1195 | If that directory doesn't exist, find a directory based on the test file |
| 1196 | name. If the file is named @file{foo-tests.el}, it returns the absolute | 1196 | name. If the test file is named @file{foo-tests.el}, it returns the |
| 1197 | file name for @file{foo-resources}. Example: | 1197 | absolute file name for @file{foo-resources}. Example: |
| 1198 | 1198 | ||
| 1199 | @lisp | 1199 | @lisp |
| 1200 | (let ((dir (ert-resource-directory))) | 1200 | (let ((dir (ert-resource-directory))) |
| 1201 | @dots{}) | 1201 | @dots{}) |
| 1202 | @end lisp | 1202 | @end lisp |
| 1203 | 1203 | ||
| 1204 | @vindex ert-resource-directory-format | ||
| 1205 | @vindex ert-resource-directory-trim-left-regexp | ||
| 1206 | @vindex ert-resource-directory-trim-right-regexp | ||
| 1204 | In order to use a different resource directory naming scheme, the | 1207 | In order to use a different resource directory naming scheme, the |
| 1205 | variable @code{ert-resource-directory-format} can be changed. Before | 1208 | variable @code{ert-resource-directory-format} can be changed. Before |
| 1206 | formatting, the file name will be trimmed using @code{string-trim} with | 1209 | formatting, the file name will be trimmed using @code{string-trim} with |
| @@ -1229,23 +1232,25 @@ defined as any file placed in the resource directory as returned by | |||
| 1229 | @end lisp | 1232 | @end lisp |
| 1230 | 1233 | ||
| 1231 | It returns the absolute file name for @file{foo-resources/bar/baz} when | 1234 | It returns the absolute file name for @file{foo-resources/bar/baz} when |
| 1232 | called in file @file{foo-tests.el}. | 1235 | called in test file @file{foo-tests.el}. |
| 1233 | @end defmac | 1236 | @end defmac |
| 1234 | 1237 | ||
| 1235 | @defmac ert-with-temp-file (name &rest body) | 1238 | @defmac ert-with-temp-file (name &rest body) |
| 1236 | This macro binds @var{name} to the name of a new temporary file and evaluates @var{body}. | 1239 | This macro binds @var{name} to the name of a new temporary file and |
| 1237 | It deletes the temporary file after @var{body} exits normally or | 1240 | evaluates @var{body}. It deletes the temporary file after @var{body} |
| 1238 | non-locally. @var{name} will be bound to the file name of the temporary | 1241 | exits normally or non-locally. @var{name} will be bound to the file |
| 1239 | file. | 1242 | name of the temporary file. |
| 1240 | 1243 | ||
| 1241 | The following keyword arguments are supported: | 1244 | The following keyword arguments are supported: |
| 1242 | 1245 | ||
| 1243 | @table @code | 1246 | @table @code |
| 1247 | @vindex ert-temp-file-prefix | ||
| 1244 | @item :prefix @var{string} | 1248 | @item :prefix @var{string} |
| 1245 | If non-nil, pass @var{string} to @code{make-temp-file} as | 1249 | If non-nil, pass @var{string} to @code{make-temp-file} as |
| 1246 | the @var{prefix} argument. Otherwise, use the value of | 1250 | the @var{prefix} argument. Otherwise, use the value of |
| 1247 | @code{ert-temp-file-prefix}. | 1251 | @code{ert-temp-file-prefix}. |
| 1248 | 1252 | ||
| 1253 | @vindex ert-temp-file-suffix | ||
| 1249 | @item :suffix @var{string} | 1254 | @item :suffix @var{string} |
| 1250 | If non-nil, pass @var{string} to @code{make-temp-file} as the | 1255 | If non-nil, pass @var{string} to @code{make-temp-file} as the |
| 1251 | @var{suffix} argument. Otherwise, use the value of | 1256 | @var{suffix} argument. Otherwise, use the value of |
| @@ -1254,7 +1259,8 @@ generate a suffix based on the name of the file that | |||
| 1254 | @code{ert-with-temp-file} is called from. | 1259 | @code{ert-with-temp-file} is called from. |
| 1255 | 1260 | ||
| 1256 | @item :text @var{string} | 1261 | @item :text @var{string} |
| 1257 | If non-nil, pass @var{string} to @code{make-temp-file} as the @var{text} argument. | 1262 | If non-nil, pass @var{string} to @code{make-temp-file} as the @var{text} |
| 1263 | argument. | ||
| 1258 | 1264 | ||
| 1259 | @item :buffer @var{symbol} | 1265 | @item :buffer @var{symbol} |
| 1260 | Open the temporary file using @code{find-file-noselect} and bind | 1266 | Open the temporary file using @code{find-file-noselect} and bind |
| @@ -1307,7 +1313,7 @@ be possible when running on MS Windows). The default value is | |||
| 1307 | 1313 | ||
| 1308 | If a real remote connection shall be used for testing, this can be | 1314 | If a real remote connection shall be used for testing, this can be |
| 1309 | overwritten by the environment variable | 1315 | overwritten by the environment variable |
| 1310 | @env{REMOTE_TEMPORARY_FILE_DIRECTORY}. Example | 1316 | @env{REMOTE_TEMPORARY_FILE_DIRECTORY}. Example: |
| 1311 | 1317 | ||
| 1312 | @example | 1318 | @example |
| 1313 | # env REMOTE_TEMPORARY_FILE_DIRECTORY=/ssh:host:/tmp make @dots{} | 1319 | # env REMOTE_TEMPORARY_FILE_DIRECTORY=/ssh:host:/tmp make @dots{} |
| @@ -1330,8 +1336,8 @@ symbol and the rest are arguments to the command. Example: | |||
| 1330 | @end lisp | 1336 | @end lisp |
| 1331 | 1337 | ||
| 1332 | @strong{Note}: Since the command is not called by | 1338 | @strong{Note}: Since the command is not called by |
| 1333 | @code{call-interactively}, a test for @code{(called-interactively-p 'interactive)} | 1339 | @code{call-interactively}, a test for @code{(called-interactively-p |
| 1334 | in the command will fail. | 1340 | 'interactive)} in the command will fail. |
| 1335 | @end defun | 1341 | @end defun |
| 1336 | 1342 | ||
| 1337 | @defmac ert-simulate-keys (keys &rest body) | 1343 | @defmac ert-simulate-keys (keys &rest body) |
| @@ -1365,11 +1371,12 @@ Example: | |||
| 1365 | @end defun | 1371 | @end defun |
| 1366 | 1372 | ||
| 1367 | @defun ert-propertized-string (&rest args) | 1373 | @defun ert-propertized-string (&rest args) |
| 1368 | This function returns a string with properties as specified by @var{args}. | 1374 | This function returns a string with properties as specified by |
| 1375 | @var{args}. | ||
| 1369 | 1376 | ||
| 1370 | @var{args} is a list of strings and plists. The strings in @var{args} | 1377 | @var{args} is a list of strings and plists. The strings in @var{args} |
| 1371 | are concatenated to produce an output string. In the output string, | 1378 | are concatenated to produce an output string. In the output string, |
| 1372 | each string from @var{args} will be have the preceding plist as its | 1379 | each string from @var{args} will have the preceding plist as its |
| 1373 | property list, or no properties if there is no plist before it. | 1380 | property list, or no properties if there is no plist before it. |
| 1374 | Example: | 1381 | Example: |
| 1375 | 1382 | ||