; Fix tabulated-list-mode tests after revert

* test/lisp/emacs-lisp/tabulated-list-tests.el
(tabulated-list-print, tabulated-list-sort): Fix tests.
This commit is contained in:
Stefan Kangas 2022-01-11 06:14:12 +01:00
parent 99a9b545f0
commit 8db5f82d45

View file

@ -55,28 +55,37 @@
(ert-deftest tabulated-list-print () (ert-deftest tabulated-list-print ()
(tabulated-list--test-with-buffer (tabulated-list--test-with-buffer
;; Basic printing. ;; Basic printing.
(should (string= (buffer-substring-no-properties (point-min) (point-max)) (should (string-equal
" zzzz-game zzzz-game 2113 installed play zzzz in Emacs (buffer-substring-no-properties (point-min) (point-max))
4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions "\
abc-mode abc-mode 944 available Major mode for editing abc music files zzzz-game zzzz-game 2113 installed play zzzz in Emacs
mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions
abc-mode abc-mode 944 available Major mode for editing abc music files
mode mode 1128 installed A simple mode for editing Actionscript 3 files
"))
;; Preserve position. ;; Preserve position.
(forward-line 3) (forward-line 3)
(let ((pos (thing-at-point 'line))) (let ((pos (thing-at-point 'line)))
(pop tabulated-list-entries) (pop tabulated-list-entries)
(tabulated-list-print t) (tabulated-list-print t)
(should (equal (thing-at-point 'line) pos)) (should (equal (thing-at-point 'line) pos))
(should (string= (buffer-substring-no-properties (point-min) (point-max)) (should (string-equal
" 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions (buffer-substring-no-properties (point-min) (point-max))
abc-mode abc-mode 944 available Major mode for editing abc music files "\
mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions
abc-mode abc-mode 944 available Major mode for editing abc music files
mode mode 1128 installed A simple mode for editing Actionscript 3 files
"))
;; Check the UPDATE argument ;; Check the UPDATE argument
(pop tabulated-list-entries) (pop tabulated-list-entries)
(setf (cdr (car tabulated-list-entries)) (list ["x" "x" "944" "available" " XX"])) (setf (cdr (car tabulated-list-entries)) (list ["x" "x" "944" "available" " XX"]))
(tabulated-list-print t t) (tabulated-list-print t t)
(should (string= (buffer-substring-no-properties (point-min) (point-max)) (should (string-equal
" x x 944 available XX (buffer-substring-no-properties (point-min) (point-max))
mode mode 1128 installed A simple mode for editing Actionscript 3 files\n")) "\
x x 944 available XX
mode mode 1128 installed A simple mode for editing Actionscript 3 files
"))
(should (equal (thing-at-point 'line) pos))))) (should (equal (thing-at-point 'line) pos)))))
(ert-deftest tabulated-list-sort () (ert-deftest tabulated-list-sort ()
@ -86,11 +95,14 @@
(skip-chars-forward "[:blank:]") (skip-chars-forward "[:blank:]")
(tabulated-list-sort) (tabulated-list-sort)
(let ((text (buffer-substring-no-properties (point-min) (point-max)))) (let ((text (buffer-substring-no-properties (point-min) (point-max))))
(should (string= text (should (string-equal
" 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions text
abc-mode abc-mode 944 available Major mode for editing abc music files "\
mode mode 1128 installed A simple mode for editing Actionscript 3 files 4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions
zzzz-game zzzz-game 2113 installed play zzzz in Emacs\n")) abc-mode abc-mode 944 available Major mode for editing abc music files
mode mode 1128 installed A simple mode for editing Actionscript 3 files
zzzz-game zzzz-game 2113 installed play zzzz in Emacs
"))
(skip-chars-forward "^[:blank:]") (skip-chars-forward "^[:blank:]")
(skip-chars-forward "[:blank:]") (skip-chars-forward "[:blank:]")
@ -101,11 +113,14 @@
(should (string= text (buffer-substring-no-properties (point-min) (point-max)))) (should (string= text (buffer-substring-no-properties (point-min) (point-max))))
;; Invert. ;; Invert.
(tabulated-list-sort 1) (tabulated-list-sort 1)
(should (string= (buffer-substring-no-properties (point-min) (point-max)) (should (string-equal
" zzzz-game zzzz-game 2113 installed play zzzz in Emacs (buffer-substring-no-properties (point-min) (point-max))
mode mode 1128 installed A simple mode for editing Actionscript 3 files "\
abc-mode abc-mode 944 available Major mode for editing abc music files zzzz-game zzzz-game 2113 installed play zzzz in Emacs
4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions\n")) mode mode 1128 installed A simple mode for editing Actionscript 3 files
abc-mode abc-mode 944 available Major mode for editing abc music files
4clojure 4clojure 1507 obsolete Open and evaluate 4clojure.com questions
"))
;; Again ;; Again
(tabulated-list-sort 1) (tabulated-list-sort 1)
(should (string= text (buffer-substring-no-properties (point-min) (point-max))))) (should (string= text (buffer-substring-no-properties (point-min) (point-max)))))