aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMichael Albinus2025-02-10 11:30:32 +0100
committerMichael Albinus2025-02-10 11:30:32 +0100
commitb92cfadc6af3abf773f666bedc571bb85402b001 (patch)
tree7ca092bf18ddfa6e82ff150c94a81e1340922a67 /doc
parentefa9b97b454d2bf56d50fb4ef37e8378bb2e4b2a (diff)
downloademacs-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.texi47
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
1110This uses the test buffer @t{"*Test buffer (backtrace-tests--variables): 1110This uses the test buffer @file{*Test buffer
1111variables*"}. 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
1133This displays a temporary buffer @t{" *temp*-739785"*}. 1133This 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
1149This displays the test buffer @t{"*Test buffer 1149This 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
1162to @var{buffer-name}. 1162to @var{buffer-name}.
1163 1163
1164This is useful if @var{body} has undesirable side-effects on an Emacs 1164This is useful if @var{body} has undesirable side-effects on an Emacs
1165buffer with a fixed name such as @t{"*Messages*"}. Example: 1165buffer 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
1178the above mentioned functions will not be captured. 1178the above mentioned functions will not be captured.
1179 1179
1180This is useful for separating the issuance of messages by the code under 1180This is useful for separating the issuance of messages by the code under
1181test from the behavior of the @t{"*Messages*"} buffer. Example: 1181test 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
1193the same directory as the test file this is called from. 1193the same directory as the test file this is called from.
1194 1194
1195If that directory doesn't exist, find a directory based on the test file 1195If that directory doesn't exist, find a directory based on the test file
1196name. If the file is named @file{foo-tests.el}, it returns the absolute 1196name. If the test file is named @file{foo-tests.el}, it returns the
1197file name for @file{foo-resources}. Example: 1197absolute 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
1204In order to use a different resource directory naming scheme, the 1207In order to use a different resource directory naming scheme, the
1205variable @code{ert-resource-directory-format} can be changed. Before 1208variable @code{ert-resource-directory-format} can be changed. Before
1206formatting, the file name will be trimmed using @code{string-trim} with 1209formatting, 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
1231It returns the absolute file name for @file{foo-resources/bar/baz} when 1234It returns the absolute file name for @file{foo-resources/bar/baz} when
1232called in file @file{foo-tests.el}. 1235called 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)
1236This macro binds @var{name} to the name of a new temporary file and evaluates @var{body}. 1239This macro binds @var{name} to the name of a new temporary file and
1237It deletes the temporary file after @var{body} exits normally or 1240evaluates @var{body}. It deletes the temporary file after @var{body}
1238non-locally. @var{name} will be bound to the file name of the temporary 1241exits normally or non-locally. @var{name} will be bound to the file
1239file. 1242name of the temporary file.
1240 1243
1241The following keyword arguments are supported: 1244The 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}
1245If non-nil, pass @var{string} to @code{make-temp-file} as 1249If non-nil, pass @var{string} to @code{make-temp-file} as
1246the @var{prefix} argument. Otherwise, use the value of 1250the @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}
1250If non-nil, pass @var{string} to @code{make-temp-file} as the 1255If 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}
1257If non-nil, pass @var{string} to @code{make-temp-file} as the @var{text} argument. 1262If non-nil, pass @var{string} to @code{make-temp-file} as the @var{text}
1263argument.
1258 1264
1259@item :buffer @var{symbol} 1265@item :buffer @var{symbol}
1260Open the temporary file using @code{find-file-noselect} and bind 1266Open 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
1308If a real remote connection shall be used for testing, this can be 1314If a real remote connection shall be used for testing, this can be
1309overwritten by the environment variable 1315overwritten 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
1334in 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)
1368This function returns a string with properties as specified by @var{args}. 1374This 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}
1371are concatenated to produce an output string. In the output string, 1378are concatenated to produce an output string. In the output string,
1372each string from @var{args} will be have the preceding plist as its 1379each string from @var{args} will have the preceding plist as its
1373property list, or no properties if there is no plist before it. 1380property list, or no properties if there is no plist before it.
1374Example: 1381Example:
1375 1382