diff options
| author | Stefan Kangas | 2020-01-26 04:08:33 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2020-01-26 04:11:38 +0100 |
| commit | e97da6b08b1849fa9138fffce01e2ed0b8e2cc5c (patch) | |
| tree | 0a875f52ab0663f59ac828c68e129ad1d9237861 /test/lisp | |
| parent | 5ba6df774eef64fc6e2cd962f8502a8d371ed85a (diff) | |
| download | emacs-e97da6b08b1849fa9138fffce01e2ed0b8e2cc5c.tar.gz emacs-e97da6b08b1849fa9138fffce01e2ed0b8e2cc5c.zip | |
Add more tests for bookmark-bmenu-list
* test/lisp/bookmark-tests.el (cl-lib): Require.
(bookmark-test-bmenu-toggle-filenames)
(bookmark-test-bmenu-toggle-filenames/show)
(bookmark-test-bmenu-show-filenames)
(bookmark-test-bmenu-hide-filenames)
(bookmark-test-bmenu-bookmark, bookmark-test-bmenu-mark)
(bookmark-test-bmenu-any-marks, bookmark-test-bmenu-unmark)
(bookmark-test-bmenu-delete, bookmark-test-bmenu-locate): New
tests.
(bookmark-test-bmenu-edit-annotation/show-annotation): Rename from
'bookmark-bmenu-edit-annotation/show-annotation'.
(bookmark-test-bmenu-send-edited-annotation): Rename from
'bookmark-bmenu-send-edited-annotation'.
(bookmark-test-bmenu-send-edited-annotation/restore-focus): Rename
from 'bookmark-bmenu-send-edited-annotation/restore-focus'.
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/bookmark-tests.el | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/test/lisp/bookmark-tests.el b/test/lisp/bookmark-tests.el index 7e0384b7241..b9c6ff9c542 100644 --- a/test/lisp/bookmark-tests.el +++ b/test/lisp/bookmark-tests.el | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | (require 'ert) | 26 | (require 'ert) |
| 27 | (require 'bookmark) | 27 | (require 'bookmark) |
| 28 | (require 'cl-lib) | ||
| 28 | 29 | ||
| 29 | (defvar bookmark-tests-data-dir | 30 | (defvar bookmark-tests-data-dir |
| 30 | (file-truename | 31 | (file-truename |
| @@ -339,21 +340,21 @@ testing `bookmark-bmenu-list'." | |||
| 339 | ,@body) | 340 | ,@body) |
| 340 | (kill-buffer bookmark-bmenu-buffer))))) | 341 | (kill-buffer bookmark-bmenu-buffer))))) |
| 341 | 342 | ||
| 342 | (ert-deftest bookmark-bmenu.enu-edit-annotation/show-annotation () | 343 | (ert-deftest bookmark-test-bmenu-edit-annotation/show-annotation () |
| 343 | (with-bookmark-bmenu-test | 344 | (with-bookmark-bmenu-test |
| 344 | (bookmark-set-annotation "name" "foo") | 345 | (bookmark-set-annotation "name" "foo") |
| 345 | (bookmark-bmenu-edit-annotation) | 346 | (bookmark-bmenu-edit-annotation) |
| 346 | (should (string-match "foo" (buffer-string))) | 347 | (should (string-match "foo" (buffer-string))) |
| 347 | (kill-buffer (current-buffer)))) | 348 | (kill-buffer (current-buffer)))) |
| 348 | 349 | ||
| 349 | (ert-deftest bookmark-bmenu-send-edited-annotation () | 350 | (ert-deftest bookmark-test-bmenu-send-edited-annotation () |
| 350 | (with-bookmark-bmenu-test | 351 | (with-bookmark-bmenu-test |
| 351 | (bookmark-bmenu-edit-annotation) | 352 | (bookmark-bmenu-edit-annotation) |
| 352 | (insert "foo") | 353 | (insert "foo") |
| 353 | (bookmark-send-edited-annotation) | 354 | (bookmark-send-edited-annotation) |
| 354 | (should (equal (bookmark-get-annotation "name") "foo")))) | 355 | (should (equal (bookmark-get-annotation "name") "foo")))) |
| 355 | 356 | ||
| 356 | (ert-deftest bookmark-bmenu-send-edited-annotation/restore-focus () | 357 | (ert-deftest bookmark-test-bmenu-send-edited-annotation/restore-focus () |
| 357 | "Test for https://debbugs.gnu.org/20150 ." | 358 | "Test for https://debbugs.gnu.org/20150 ." |
| 358 | (with-bookmark-bmenu-test | 359 | (with-bookmark-bmenu-test |
| 359 | (bookmark-bmenu-edit-annotation) | 360 | (bookmark-bmenu-edit-annotation) |
| @@ -362,5 +363,73 @@ testing `bookmark-bmenu-list'." | |||
| 362 | (should (equal (buffer-name (current-buffer)) bookmark-bmenu-buffer)) | 363 | (should (equal (buffer-name (current-buffer)) bookmark-bmenu-buffer)) |
| 363 | (should (looking-at "name")))) | 364 | (should (looking-at "name")))) |
| 364 | 365 | ||
| 366 | (ert-deftest bookmark-test-bmenu-toggle-filenames () | ||
| 367 | (with-bookmark-bmenu-test | ||
| 368 | (should (re-search-forward "/some/file" nil t)) | ||
| 369 | (bookmark-bmenu-toggle-filenames) | ||
| 370 | (goto-char (point-min)) | ||
| 371 | (should-not (re-search-forward "/some/file" nil t)))) | ||
| 372 | |||
| 373 | (ert-deftest bookmark-test-bmenu-toggle-filenames/show () | ||
| 374 | (with-bookmark-bmenu-test | ||
| 375 | (bookmark-bmenu-toggle-filenames t) | ||
| 376 | (should (re-search-forward "/some/file")))) | ||
| 377 | |||
| 378 | (ert-deftest bookmark-test-bmenu-show-filenames () | ||
| 379 | (with-bookmark-bmenu-test | ||
| 380 | (bookmark-bmenu-show-filenames) | ||
| 381 | (should (re-search-forward "/some/file")))) | ||
| 382 | |||
| 383 | (ert-deftest bookmark-test-bmenu-hide-filenames () | ||
| 384 | (with-bookmark-bmenu-test | ||
| 385 | (bookmark-bmenu-hide-filenames) | ||
| 386 | (goto-char (point-min)) | ||
| 387 | (should-not (re-search-forward "/some/file" nil t)))) | ||
| 388 | |||
| 389 | (ert-deftest bookmark-test-bmenu-bookmark () | ||
| 390 | (with-bookmark-bmenu-test | ||
| 391 | (should (equal (bookmark-bmenu-bookmark) "name")))) | ||
| 392 | |||
| 393 | (ert-deftest bookmark-test-bmenu-mark () | ||
| 394 | (with-bookmark-bmenu-test | ||
| 395 | (bookmark-bmenu-mark) | ||
| 396 | (beginning-of-line) | ||
| 397 | (should (looking-at "^>")))) | ||
| 398 | |||
| 399 | (ert-deftest bookmark-test-bmenu-any-marks () | ||
| 400 | (with-bookmark-bmenu-test | ||
| 401 | (bookmark-bmenu-mark) | ||
| 402 | (beginning-of-line) | ||
| 403 | (should (bookmark-bmenu-any-marks)))) | ||
| 404 | |||
| 405 | (ert-deftest bookmark-test-bmenu-unmark () | ||
| 406 | (with-bookmark-bmenu-test | ||
| 407 | (bookmark-bmenu-mark) | ||
| 408 | (goto-char (point-min)) | ||
| 409 | (bookmark-bmenu-unmark) | ||
| 410 | (beginning-of-line) | ||
| 411 | (should (looking-at "^ ")))) | ||
| 412 | |||
| 413 | (ert-deftest bookmark-test-bmenu-delete () | ||
| 414 | (with-bookmark-bmenu-test | ||
| 415 | (bookmark-bmenu-delete) | ||
| 416 | (bookmark-bmenu-execute-deletions) | ||
| 417 | (should (equal (length bookmark-alist) 0)))) | ||
| 418 | |||
| 419 | (ert-deftest bookmark-test-bmenu-locate () | ||
| 420 | (let (msg) | ||
| 421 | (cl-letf (((symbol-function 'message) | ||
| 422 | (lambda (&rest args) | ||
| 423 | (setq msg (apply #'format args))))) | ||
| 424 | (with-bookmark-bmenu-test | ||
| 425 | (bookmark-bmenu-locate) | ||
| 426 | (should (equal msg "/some/file")))))) | ||
| 427 | |||
| 428 | (ert-deftest bookmark-test-bmenu-filter-alist-by-regexp () | ||
| 429 | (with-bookmark-bmenu-test | ||
| 430 | (bookmark-bmenu-filter-alist-by-regexp regexp-unmatchable) | ||
| 431 | (goto-char (point-min)) | ||
| 432 | (should (looking-at "^$")))) | ||
| 433 | |||
| 365 | (provide 'bookmark-tests) | 434 | (provide 'bookmark-tests) |
| 366 | ;;; bookmark-tests.el ends here | 435 | ;;; bookmark-tests.el ends here |