<commit_before>;;; ../test/test-core-lib-buffers.el

(def-test-group! core-lib-buffers
  (ert-deftest get-buffers ()
    (let ((a (get-buffer-create "*a*"))
          (b (get-buffer-create "*b*"))
          (c (get-buffer-create "*c*"))
          (buffers (doom-buffer-list)))
      (should buffers)
      (should (cl-every (lambda (b) (memq b buffers)) (list a b c)))
      (should (cl-every 'bufferp buffers))))

  (ert-deftest matching-buffers ()
    (let ((a (get-buffer-create "*a*"))
          (b (get-buffer-create "*b*"))
          (c (get-buffer-create "*c*"))
          (buffers (doom-matching-buffers "^\\*[ac]\\*$")))
      (should (= 2 (length buffers)))
      (should (cl-every (lambda (b) (memq b buffers)) (list a c)))
      (should (cl-every 'bufferp buffers))))

  (ert-deftest buffers-in-mode ()
    (dolist (name (list "*a*" "*b*"))
      (with-current-buffer (get-buffer-create name)
        (emacs-lisp-mode)))
    (dolist (name (list "*c*" "*d*" "*e*"))
      (with-current-buffer (get-buffer-create name)
        (text-mode)))
    (let ((el-buffers (doom-buffers-in-mode 'emacs-lisp-mode))
          (txt-buffers (doom-buffers-in-mode 'text-mode)))
      (should (cl-every 'bufferp (append el-buffers txt-buffers)))
      (should (= 2 (length el-buffers)))
      (should (= 3 (length txt-buffers)))))

  ;; TODO
  )<commit_msg>test/test-core-lib-buffers: rearrange buffer & membership checks<commit_after>;;; ../test/test-core-lib-buffers.el

(def-test-group! core-lib-buffers
  (ert-deftest get-buffers ()
    (let ((a (get-buffer-create "*a*"))
          (b (get-buffer-create "*b*"))
          (c (get-buffer-create "*c*"))
          (buffers (doom-buffer-list)))
      (should buffers)
      (should (cl-every 'bufferp buffers))
      (should (cl-every (lambda (b) (memq b buffers)) (list a b c)))))

  (ert-deftest matching-buffers ()
    (let ((a (get-buffer-create "*a*"))
          (b (get-buffer-create "*b*"))
          (c (get-buffer-create "*c*"))
          (buffers (doom-matching-buffers "^\\*[ac]\\*$")))
      (should (= 2 (length buffers)))
      (should (cl-every 'bufferp buffers))
      (should (cl-every (lambda (b) (memq b buffers)) (list a c)))))

  (ert-deftest buffers-in-mode ()
    (dolist (name (list "*a*" "*b*"))
      (with-current-buffer (get-buffer-create name)
        (emacs-lisp-mode)))
    (dolist (name (list "*c*" "*d*" "*e*"))
      (with-current-buffer (get-buffer-create name)
        (text-mode)))
    (let ((el-buffers (doom-buffers-in-mode 'emacs-lisp-mode))
          (txt-buffers (doom-buffers-in-mode 'text-mode)))
      (should (cl-every 'bufferp (append el-buffers txt-buffers)))
      (should (= 2 (length el-buffers)))
      (should (= 3 (length txt-buffers)))))

  ;; TODO
  )
{'fraction_non_alphanumeric': 0.21067925899019252, 'fraction_numerical': 0.002179440610243371, 'mean_word_length': 2.633245382585752, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '751260', 'n_tokens_mistral': 1018, 'n_tokens_neox': 989, 'n_words': 226}