@@ -213,3 +213,30 @@ Array.valueOf
213
213
" Array.propertyIsEnumerable"
214
214
" Array.toLocaleString"
215
215
" Array.valueOf" ))))
216
+
217
+ (ert-deftest js-comint--completion-filter/test-discard ()
218
+ " Output should be discarded."
219
+ (with-temp-buffer
220
+ (js-comint--reset-completion-state)
221
+ (setq js-comint--discard-output 't )
222
+ ; ; each should be empty
223
+ (dolist (res (list (js-comint--completion-filter " foo" )
224
+ (js-comint--completion-filter " bar" )
225
+ (js-comint--completion-filter " [1G" )))
226
+ (should (string-empty-p res)))
227
+ ; ; then the the flag should be cleared
228
+ (should-not js-comint--discard-output)))
229
+
230
+ (ert-deftest js-comint--completion-filter/test-discard-with-completion ()
231
+ " Output should be discarded even when completion callback is set."
232
+ (with-temp-buffer
233
+ (js-comint--reset-completion-state)
234
+ (setq js-comint--discard-output 't )
235
+ (setq js-comint--post-completion-cb #'ignore )
236
+ ; ; each should be empty
237
+ (dolist (res (list (js-comint--completion-filter " foo" )
238
+ (js-comint--completion-filter " bar" )
239
+ (js-comint--completion-filter " [1G" )))
240
+ (should (string-empty-p res)))
241
+ ; ; the output should not be accumulated
242
+ (should (string-empty-p js-comint--completion-output))))
0 commit comments