You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/etest/README.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,34 @@ The `:cleanup` takes lisp expressions evaluated in LIFO order with unwind protec
137
137
```
138
138
139
139
140
+
## Reusing mode-specific configuration
141
+
142
+
Mode-specific configuration can be stored in a variable or created with a function. This typically includes an `:init` keyword that sets up the major-mode for the test buffer:
143
+
144
+
```elisp
145
+
(defvar my-config '(:init ((mode . text))))
146
+
```
147
+
148
+
The configuration may contain any valid etest code and is registered with the `:config` keyword. This keyword must appear before any other keywords:
149
+
150
+
```elisp
151
+
(etest-deftest my-test ()
152
+
:config my-config))
153
+
```
154
+
155
+
You can also set it with the buffer-local variable `etest-local-config`. It is convenient to set it as a file-local variable, this way `etest-update` is automatically aware of the configuration relevant to the test file.
156
+
157
+
```elisp
158
+
(etest-deftest my-test ())
159
+
160
+
;; Local Variables:
161
+
;; etest-local-config: my-config
162
+
;; End:
163
+
```
164
+
165
+
If supplied, the `:config` keyword has precedence over the configuration stored in `etest-local-config` and completely replaces it.
166
+
167
+
140
168
## Checking the contents of an inferior buffer
141
169
142
170
In addition to checking the side effects in the test buffer, it is often useful to check the side effects in an auxiliary buffer. For instance, checking the output in an inferior process buffer.
0 commit comments