diff options
| author | Po Lu | 2021-12-05 08:36:40 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-05 08:36:40 +0800 |
| commit | 360d2d3a3328799ed8fea27bc7c13873f84b65fa (patch) | |
| tree | 579a7c080390d29b1aa6f772559c0f1946228779 /test | |
| parent | f851e725b35d2ebd51b829059761a232d2ca1fbb (diff) | |
| parent | b3505e31d6ce4ea7c2cf1b01b8b7357b1f527bf1 (diff) | |
| download | emacs-360d2d3a3328799ed8fea27bc7c13873f84b65fa.tar.gz emacs-360d2d3a3328799ed8fea27bc7c13873f84b65fa.zip | |
Merge remote-tracking branch 'origin/master' into feature/pgtk
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/calendar/time-date-tests.el | 7 | ||||
| -rw-r--r-- | test/lisp/dired-tests.el | 49 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/derived-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/eieio-tests/eieio-tests.el | 47 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/generator-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/lisp-tests.el | 1 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el | 20 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/subr-x-tests.el | 26 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/timer-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/format-spec-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/ls-lisp-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/obsolete/cl-tests.el | 11 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 18 | ||||
| -rw-r--r-- | test/lisp/replace-tests.el | 11 | ||||
| -rw-r--r-- | test/lisp/ses-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/subr-tests.el | 1 | ||||
| -rw-r--r-- | test/lisp/tar-mode-tests.el | 8 | ||||
| -rw-r--r-- | test/src/data-tests.el | 41 | ||||
| -rw-r--r-- | test/src/search-tests.el | 2 |
20 files changed, 164 insertions, 103 deletions
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el index 4568947c0b3..d5269804ad2 100644 --- a/test/lisp/calendar/time-date-tests.el +++ b/test/lisp/calendar/time-date-tests.el | |||
| @@ -41,6 +41,13 @@ | |||
| 41 | (encode-time-value 1 2 3 4 3)) | 41 | (encode-time-value 1 2 3 4 3)) |
| 42 | '(1 2 3 4)))) | 42 | '(1 2 3 4)))) |
| 43 | 43 | ||
| 44 | (ert-deftest test-date-to-time () | ||
| 45 | (should (equal (format-time-string "%F %T" (date-to-time "2021-12-04")) | ||
| 46 | "2021-12-04 00:00:00"))) | ||
| 47 | |||
| 48 | (ert-deftest test-days-between () | ||
| 49 | (should (equal (days-between "2021-10-22" "2020-09-29") 388))) | ||
| 50 | |||
| 44 | (ert-deftest test-leap-year () | 51 | (ert-deftest test-leap-year () |
| 45 | (should-not (date-leap-year-p 1999)) | 52 | (should-not (date-leap-year-p 1999)) |
| 46 | (should-not (date-leap-year-p 1900)) | 53 | (should-not (date-leap-year-p 1900)) |
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 43791118f14..1c4f37bd327 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el | |||
| @@ -543,10 +543,12 @@ path's data to use." | |||
| 543 | ((equal "." path) default-directory) | 543 | ((equal "." path) default-directory) |
| 544 | (path))) | 544 | (path))) |
| 545 | (return-size | 545 | (return-size |
| 546 | (car (files-tests--look-up-free-data path)))) | 546 | ;; It is always defined but this silences the byte-compiler: |
| 547 | (when (fboundp 'files-tests--look-up-free-data) | ||
| 548 | (car (files-tests--look-up-free-data path))))) | ||
| 547 | (list return-size return-size return-size)))) | 549 | (list return-size return-size return-size)))) |
| 548 | 550 | ||
| 549 | (defun files-tests--insert-directory-output (dir &optional verbose) | 551 | (defun files-tests--insert-directory-output (dir &optional _verbose) |
| 550 | "Run `insert-directory' and return its output." | 552 | "Run `insert-directory' and return its output." |
| 551 | (with-current-buffer-window "files-tests--insert-directory" nil nil | 553 | (with-current-buffer-window "files-tests--insert-directory" nil nil |
| 552 | (let ((dired-free-space 'separate)) | 554 | (let ((dired-free-space 'separate)) |
| @@ -555,35 +557,46 @@ path's data to use." | |||
| 555 | 557 | ||
| 556 | (ert-deftest files-tests-insert-directory-shows-files () | 558 | (ert-deftest files-tests-insert-directory-shows-files () |
| 557 | "Verify `insert-directory' reports the files in the directory." | 559 | "Verify `insert-directory' reports the files in the directory." |
| 558 | (let* ((test-dir (car test-files)) | 560 | ;; It is always defined but this silences the byte-compiler: |
| 559 | (files (cdr test-files)) | 561 | (when (fboundp 'files-tests--insert-directory-output) |
| 560 | (output (files-tests--insert-directory-output test-dir))) | 562 | (let* ((test-dir (car test-files)) |
| 561 | (dolist (file files) | 563 | (files (cdr test-files)) |
| 562 | (should (string-match-p file output))))) | 564 | (output (files-tests--insert-directory-output test-dir))) |
| 565 | (dolist (file files) | ||
| 566 | (should (string-match-p file output)))))) | ||
| 563 | 567 | ||
| 564 | (defun files-tests--insert-directory-shows-given-free (dir &optional | 568 | (defun files-tests--insert-directory-shows-given-free (dir &optional |
| 565 | info-func) | 569 | info-func) |
| 566 | "Run `insert-directory' and verify it reports the correct available space. | 570 | "Run `insert-directory' and verify it reports the correct available space. |
| 567 | Stub `file-system-info' to ensure the available space is consistent, | 571 | Stub `file-system-info' to ensure the available space is consistent, |
| 568 | either with the given stub function or a default one using test data." | 572 | either with the given stub function or a default one using test data." |
| 569 | (cl-letf (((symbol-function 'file-system-info) | 573 | ;; It is always defined but this silences the byte-compiler: |
| 570 | (or info-func | 574 | (when (and (fboundp 'files-tests--make-file-system-info-stub) |
| 571 | (files-tests--make-file-system-info-stub)))) | 575 | (fboundp 'files-tests--look-up-free-data) |
| 572 | (should (string-match-p (cadr | 576 | (fboundp 'files-tests--insert-directory-output)) |
| 573 | (files-tests--look-up-free-data dir)) | 577 | (cl-letf (((symbol-function 'file-system-info) |
| 574 | (files-tests--insert-directory-output dir t))))) | 578 | (or info-func |
| 579 | (files-tests--make-file-system-info-stub)))) | ||
| 580 | (should (string-match-p (cadr | ||
| 581 | (files-tests--look-up-free-data dir)) | ||
| 582 | (files-tests--insert-directory-output dir t)))))) | ||
| 575 | 583 | ||
| 576 | (ert-deftest files-tests-insert-directory-shows-free () | 584 | (ert-deftest files-tests-insert-directory-shows-free () |
| 577 | "Test that verbose `insert-directory' shows the correct available space." | 585 | "Test that verbose `insert-directory' shows the correct available space." |
| 578 | (files-tests--insert-directory-shows-given-free | 586 | ;; It is always defined but this silences the byte-compiler: |
| 579 | test-dir | 587 | (when (and (fboundp 'files-tests--insert-directory-shows-given-free) |
| 580 | (files-tests--make-file-system-info-stub test-dir))) | 588 | (fboundp 'files-tests--make-file-system-info-stub)) |
| 589 | (files-tests--insert-directory-shows-given-free | ||
| 590 | test-dir | ||
| 591 | (files-tests--make-file-system-info-stub test-dir)))) | ||
| 581 | 592 | ||
| 582 | (ert-deftest files-tests-bug-50630 () | 593 | (ert-deftest files-tests-bug-50630 () |
| 583 | "Verify verbose `insert-directory' shows free space of the target directory. | 594 | "Verify verbose `insert-directory' shows free space of the target directory. |
| 584 | The current directory at call time should not affect the result (Bug#50630)." | 595 | The current directory at call time should not affect the result (Bug#50630)." |
| 585 | (let ((default-directory test-dir-other)) | 596 | ;; It is always defined but this silences the byte-compiler: |
| 586 | (files-tests--insert-directory-shows-given-free test-dir)))) | 597 | (when (fboundp 'files-tests--insert-directory-shows-given-free) |
| 598 | (let ((default-directory test-dir-other)) | ||
| 599 | (files-tests--insert-directory-shows-given-free test-dir))))) | ||
| 587 | 600 | ||
| 588 | (provide 'dired-tests) | 601 | (provide 'dired-tests) |
| 589 | ;;; dired-tests.el ends here | 602 | ;;; dired-tests.el ends here |
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index be2c0fa02b4..7c3afefaadd 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el | |||
| @@ -668,6 +668,10 @@ collection clause." | |||
| 668 | #'len)) | 668 | #'len)) |
| 669 | (`(function (lambda (,_ ,_) . ,_)) t)))) | 669 | (`(function (lambda (,_ ,_) . ,_)) t)))) |
| 670 | 670 | ||
| 671 | (with-suppressed-warnings ((lexical test) (lexical test1) (lexical test2)) | ||
| 672 | (defvar test) | ||
| 673 | (defvar test1) | ||
| 674 | (defvar test2)) | ||
| 671 | (ert-deftest cl-macs--progv () | 675 | (ert-deftest cl-macs--progv () |
| 672 | (should (= (cl-progv '(test test) '(1 2) test) 2)) | 676 | (should (= (cl-progv '(test test) '(1 2) test) 2)) |
| 673 | (should (equal (cl-progv '(test1 test2) '(1 2) (list test1 test2)) | 677 | (should (equal (cl-progv '(test1 test2) '(1 2) (list test1 test2)) |
diff --git a/test/lisp/emacs-lisp/derived-tests.el b/test/lisp/emacs-lisp/derived-tests.el index 9c8e6c33b4c..2647b86826a 100644 --- a/test/lisp/emacs-lisp/derived-tests.el +++ b/test/lisp/emacs-lisp/derived-tests.el | |||
| @@ -24,13 +24,13 @@ | |||
| 24 | (define-derived-mode derived-tests--parent-mode prog-mode "P" | 24 | (define-derived-mode derived-tests--parent-mode prog-mode "P" |
| 25 | :after-hook | 25 | :after-hook |
| 26 | (let ((f (let ((x "S")) (lambda () x)))) | 26 | (let ((f (let ((x "S")) (lambda () x)))) |
| 27 | (insert (format "AFP=%s " (let ((x "D")) (funcall f))))) | 27 | (insert (format "AFP=%s " (let ((x "D")) x (funcall f))))) |
| 28 | (insert "PB ")) | 28 | (insert "PB ")) |
| 29 | 29 | ||
| 30 | (define-derived-mode derived-tests--child-mode derived-tests--parent-mode "C" | 30 | (define-derived-mode derived-tests--child-mode derived-tests--parent-mode "C" |
| 31 | :after-hook | 31 | :after-hook |
| 32 | (let ((f (let ((x "S")) (lambda () x)))) | 32 | (let ((f (let ((x "S")) (lambda () x)))) |
| 33 | (insert (format "AFC=%s " (let ((x "D")) (funcall f))))) | 33 | (insert (format "AFC=%s " (let ((x "D")) x (funcall f))))) |
| 34 | (insert "CB ")) | 34 | (insert "CB ")) |
| 35 | 35 | ||
| 36 | (ert-deftest derived-tests-after-hook-lexical () | 36 | (ert-deftest derived-tests-after-hook-lexical () |
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index ba2e5f7be4a..6f6a1f4f19a 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el | |||
| @@ -172,7 +172,7 @@ | |||
| 172 | ;; Check that generic-p works | 172 | ;; Check that generic-p works |
| 173 | (should (generic-p 'generic1)) | 173 | (should (generic-p 'generic1)) |
| 174 | 174 | ||
| 175 | (defmethod generic1 ((c class-a)) | 175 | (defmethod generic1 ((_c class-a)) |
| 176 | "Method on generic1." | 176 | "Method on generic1." |
| 177 | 'monkey) | 177 | 'monkey) |
| 178 | 178 | ||
| @@ -240,12 +240,12 @@ Argument C is the class bound to this static method." | |||
| 240 | (should (make-instance 'class-a :water 'cho)) | 240 | (should (make-instance 'class-a :water 'cho)) |
| 241 | (should (make-instance 'class-b))) | 241 | (should (make-instance 'class-b))) |
| 242 | 242 | ||
| 243 | (defmethod class-cn ((a class-a)) | 243 | (defmethod class-cn ((_a class-a)) |
| 244 | "Try calling `call-next-method' when there isn't one. | 244 | "Try calling `call-next-method' when there isn't one. |
| 245 | Argument A is object of type symbol `class-a'." | 245 | Argument A is object of type symbol `class-a'." |
| 246 | (call-next-method)) | 246 | (call-next-method)) |
| 247 | 247 | ||
| 248 | (defmethod no-next-method ((a class-a) &rest args) | 248 | (defmethod no-next-method ((_a class-a) &rest _args) |
| 249 | "Override signal throwing for variable `class-a'. | 249 | "Override signal throwing for variable `class-a'. |
| 250 | Argument A is the object of class variable `class-a'." | 250 | Argument A is the object of class variable `class-a'." |
| 251 | 'moose) | 251 | 'moose) |
| @@ -254,7 +254,7 @@ Argument A is the object of class variable `class-a'." | |||
| 254 | ;; Play with call-next-method | 254 | ;; Play with call-next-method |
| 255 | (should (eq (class-cn eitest-ab) 'moose))) | 255 | (should (eq (class-cn eitest-ab) 'moose))) |
| 256 | 256 | ||
| 257 | (defmethod no-applicable-method ((b class-b) method &rest args) | 257 | (defmethod no-applicable-method ((_b class-b) _method &rest _args) |
| 258 | "No need. | 258 | "No need. |
| 259 | Argument B is for booger. | 259 | Argument B is for booger. |
| 260 | METHOD is the method that was attempting to be called." | 260 | METHOD is the method that was attempting to be called." |
| @@ -264,38 +264,38 @@ METHOD is the method that was attempting to be called." | |||
| 264 | ;; Non-existing methods. | 264 | ;; Non-existing methods. |
| 265 | (should (eq (class-cn eitest-b) 'moose))) | 265 | (should (eq (class-cn eitest-b) 'moose))) |
| 266 | 266 | ||
| 267 | (defmethod class-fun ((a class-a)) | 267 | (defmethod class-fun ((_a class-a)) |
| 268 | "Fun with class A." | 268 | "Fun with class A." |
| 269 | 'moose) | 269 | 'moose) |
| 270 | 270 | ||
| 271 | (defmethod class-fun ((b class-b)) | 271 | (defmethod class-fun ((_b class-b)) |
| 272 | "Fun with class B." | 272 | "Fun with class B." |
| 273 | (error "Class B fun should not be called") | 273 | (error "Class B fun should not be called") |
| 274 | ) | 274 | ) |
| 275 | 275 | ||
| 276 | (defmethod class-fun-foo ((b class-b)) | 276 | (defmethod class-fun-foo ((_b class-b)) |
| 277 | "Foo Fun with class B." | 277 | "Foo Fun with class B." |
| 278 | 'moose) | 278 | 'moose) |
| 279 | 279 | ||
| 280 | (defmethod class-fun2 ((a class-a)) | 280 | (defmethod class-fun2 ((_a class-a)) |
| 281 | "More fun with class A." | 281 | "More fun with class A." |
| 282 | 'moose) | 282 | 'moose) |
| 283 | 283 | ||
| 284 | (defmethod class-fun2 ((b class-b)) | 284 | (defmethod class-fun2 ((_b class-b)) |
| 285 | "More fun with class B." | 285 | "More fun with class B." |
| 286 | (error "Class B fun2 should not be called") | 286 | (error "Class B fun2 should not be called") |
| 287 | ) | 287 | ) |
| 288 | 288 | ||
| 289 | (defmethod class-fun2 ((ab class-ab)) | 289 | (defmethod class-fun2 ((_ab class-ab)) |
| 290 | "More fun with class AB." | 290 | "More fun with class AB." |
| 291 | (call-next-method)) | 291 | (call-next-method)) |
| 292 | 292 | ||
| 293 | ;; How about if B is the only slot? | 293 | ;; How about if B is the only slot? |
| 294 | (defmethod class-fun3 ((b class-b)) | 294 | (defmethod class-fun3 ((_b class-b)) |
| 295 | "Even More fun with class B." | 295 | "Even More fun with class B." |
| 296 | 'moose) | 296 | 'moose) |
| 297 | 297 | ||
| 298 | (defmethod class-fun3 ((ab class-ab)) | 298 | (defmethod class-fun3 ((_ab class-ab)) |
| 299 | "Even More fun with class AB." | 299 | "Even More fun with class AB." |
| 300 | (call-next-method)) | 300 | (call-next-method)) |
| 301 | 301 | ||
| @@ -314,17 +314,17 @@ METHOD is the method that was attempting to be called." | |||
| 314 | 314 | ||
| 315 | 315 | ||
| 316 | (defvar class-fun-value-seq '()) | 316 | (defvar class-fun-value-seq '()) |
| 317 | (defmethod class-fun-value :BEFORE ((a class-a)) | 317 | (defmethod class-fun-value :BEFORE ((_a class-a)) |
| 318 | "Return `before', and push `before' in `class-fun-value-seq'." | 318 | "Return `before', and push `before' in `class-fun-value-seq'." |
| 319 | (push 'before class-fun-value-seq) | 319 | (push 'before class-fun-value-seq) |
| 320 | 'before) | 320 | 'before) |
| 321 | 321 | ||
| 322 | (defmethod class-fun-value :PRIMARY ((a class-a)) | 322 | (defmethod class-fun-value :PRIMARY ((_a class-a)) |
| 323 | "Return `primary', and push `primary' in `class-fun-value-seq'." | 323 | "Return `primary', and push `primary' in `class-fun-value-seq'." |
| 324 | (push 'primary class-fun-value-seq) | 324 | (push 'primary class-fun-value-seq) |
| 325 | 'primary) | 325 | 'primary) |
| 326 | 326 | ||
| 327 | (defmethod class-fun-value :AFTER ((a class-a)) | 327 | (defmethod class-fun-value :AFTER ((_a class-a)) |
| 328 | "Return `after', and push `after' in `class-fun-value-seq'." | 328 | "Return `after', and push `after' in `class-fun-value-seq'." |
| 329 | (push 'after class-fun-value-seq) | 329 | (push 'after class-fun-value-seq) |
| 330 | 'after) | 330 | 'after) |
| @@ -343,14 +343,14 @@ METHOD is the method that was attempting to be called." | |||
| 343 | ;; | 343 | ;; |
| 344 | 344 | ||
| 345 | (ert-deftest eieio-test-13-init-methods () | 345 | (ert-deftest eieio-test-13-init-methods () |
| 346 | (defmethod initialize-instance ((a class-a) &rest slots) | 346 | (defmethod initialize-instance ((a class-a) &rest _slots) |
| 347 | "Initialize the slots of class-a." | 347 | "Initialize the slots of class-a." |
| 348 | (call-next-method) | 348 | (call-next-method) |
| 349 | (if (/= (oref a test-tag) 1) | 349 | (if (/= (oref a test-tag) 1) |
| 350 | (error "shared-initialize test failed.")) | 350 | (error "shared-initialize test failed.")) |
| 351 | (oset a test-tag 2)) | 351 | (oset a test-tag 2)) |
| 352 | 352 | ||
| 353 | (defmethod shared-initialize ((a class-a) &rest slots) | 353 | (defmethod shared-initialize ((a class-a) &rest _slots) |
| 354 | "Shared initialize method for class-a." | 354 | "Shared initialize method for class-a." |
| 355 | (call-next-method) | 355 | (call-next-method) |
| 356 | (oset a test-tag 1)) | 356 | (oset a test-tag 1)) |
| @@ -369,7 +369,7 @@ METHOD is the method that was attempting to be called." | |||
| 369 | 369 | ||
| 370 | (ert-deftest eieio-test-15-slot-missing () | 370 | (ert-deftest eieio-test-15-slot-missing () |
| 371 | 371 | ||
| 372 | (defmethod slot-missing ((ab class-ab) &rest foo) | 372 | (defmethod slot-missing ((_ab class-ab) &rest _foo) |
| 373 | "If a slot in AB is unbound, return something cool. FOO." | 373 | "If a slot in AB is unbound, return something cool. FOO." |
| 374 | 'moose) | 374 | 'moose) |
| 375 | 375 | ||
| @@ -425,7 +425,7 @@ METHOD is the method that was attempting to be called." | |||
| 425 | 425 | ||
| 426 | (ert-deftest eieio-test-18-slot-unbound () | 426 | (ert-deftest eieio-test-18-slot-unbound () |
| 427 | 427 | ||
| 428 | (defmethod slot-unbound ((a class-a) &rest foo) | 428 | (defmethod slot-unbound ((_a class-a) &rest _foo) |
| 429 | "If a slot in A is unbound, ignore FOO." | 429 | "If a slot in A is unbound, ignore FOO." |
| 430 | 'moose) | 430 | 'moose) |
| 431 | 431 | ||
| @@ -448,7 +448,7 @@ METHOD is the method that was attempting to be called." | |||
| 448 | (should (eq (oref (class-a) water) 'penguin)) | 448 | (should (eq (oref (class-a) water) 'penguin)) |
| 449 | 449 | ||
| 450 | ;; Revert the above | 450 | ;; Revert the above |
| 451 | (defmethod slot-unbound ((a class-a) &rest foo) | 451 | (defmethod slot-unbound ((_a class-a) &rest _foo) |
| 452 | "If a slot in A is unbound, ignore FOO." | 452 | "If a slot in A is unbound, ignore FOO." |
| 453 | ;; Disable the old slot-unbound so we can run this test | 453 | ;; Disable the old slot-unbound so we can run this test |
| 454 | ;; more than once | 454 | ;; more than once |
| @@ -971,7 +971,7 @@ Subclasses to override slot attributes.") | |||
| 971 | 971 | ||
| 972 | ;;;; Interaction with defstruct | 972 | ;;;; Interaction with defstruct |
| 973 | 973 | ||
| 974 | (cl-defstruct eieio-test--struct a b c) | 974 | (cl-defstruct eieio-test--struct a b (c nil :read-only t)) |
| 975 | 975 | ||
| 976 | (ert-deftest eieio-test-defstruct-slot-value () | 976 | (ert-deftest eieio-test-defstruct-slot-value () |
| 977 | (let ((x (make-eieio-test--struct :a 'A :b 'B :c 'C))) | 977 | (let ((x (make-eieio-test--struct :a 'A :b 'B :c 'C))) |
| @@ -980,7 +980,10 @@ Subclasses to override slot attributes.") | |||
| 980 | (should (eq (eieio-test--struct-b x) | 980 | (should (eq (eieio-test--struct-b x) |
| 981 | (slot-value x 'b))) | 981 | (slot-value x 'b))) |
| 982 | (should (eq (eieio-test--struct-c x) | 982 | (should (eq (eieio-test--struct-c x) |
| 983 | (slot-value x 'c))))) | 983 | (slot-value x 'c))) |
| 984 | (setf (slot-value x 'a) 1) | ||
| 985 | (should (eq (eieio-test--struct-a x) 1)) | ||
| 986 | (should-error (setf (slot-value x 'c) 3) :type 'eieio-read-only))) | ||
| 984 | 987 | ||
| 985 | (provide 'eieio-tests) | 988 | (provide 'eieio-tests) |
| 986 | 989 | ||
diff --git a/test/lisp/emacs-lisp/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el index 50b8cc53a28..492c4e40853 100644 --- a/test/lisp/emacs-lisp/generator-tests.el +++ b/test/lisp/emacs-lisp/generator-tests.el | |||
| @@ -74,7 +74,7 @@ identical output." | |||
| 74 | (cps-testcase cps-prog1-b (prog1 1)) | 74 | (cps-testcase cps-prog1-b (prog1 1)) |
| 75 | (cps-testcase cps-prog1-c (prog2 1 2 3)) | 75 | (cps-testcase cps-prog1-c (prog2 1 2 3)) |
| 76 | (cps-testcase cps-quote (progn 'hello)) | 76 | (cps-testcase cps-quote (progn 'hello)) |
| 77 | (cps-testcase cps-function (progn #'hello)) | 77 | (cps-testcase cps-function (progn #'message)) |
| 78 | 78 | ||
| 79 | (cps-testcase cps-and-fail (and 1 nil 2)) | 79 | (cps-testcase cps-and-fail (and 1 nil 2)) |
| 80 | (cps-testcase cps-and-succeed (and 1 2 3)) | 80 | (cps-testcase cps-and-succeed (and 1 2 3)) |
| @@ -307,6 +307,7 @@ identical output." | |||
| 307 | (1+ it))))))) | 307 | (1+ it))))))) |
| 308 | -2))) | 308 | -2))) |
| 309 | 309 | ||
| 310 | (defun generator-tests-edebug ()) ; silence byte-compiler | ||
| 310 | (ert-deftest generator-tests-edebug () | 311 | (ert-deftest generator-tests-edebug () |
| 311 | "Check that Bug#40434 is fixed." | 312 | "Check that Bug#40434 is fixed." |
| 312 | (with-temp-buffer | 313 | (with-temp-buffer |
diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el index 8301d9906a2..7f4d50c5958 100644 --- a/test/lisp/emacs-lisp/lisp-tests.el +++ b/test/lisp/emacs-lisp/lisp-tests.el | |||
| @@ -213,6 +213,7 @@ | |||
| 213 | (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error. | 213 | (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error. |
| 214 | 214 | ||
| 215 | ;; Test some core Elisp rules. | 215 | ;; Test some core Elisp rules. |
| 216 | (defvar c-e-x) | ||
| 216 | (ert-deftest core-elisp-tests-1-defvar-in-let () | 217 | (ert-deftest core-elisp-tests-1-defvar-in-let () |
| 217 | "Test some core Elisp rules." | 218 | "Test some core Elisp rules." |
| 218 | (with-temp-buffer | 219 | (with-temp-buffer |
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 8dc0b93b5af..8cfa3bdb862 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el | |||
| @@ -172,17 +172,23 @@ Evaluate BODY for each created sequence. | |||
| 172 | (should-not (seq-find #'null '(1 2 3))) | 172 | (should-not (seq-find #'null '(1 2 3))) |
| 173 | (should (seq-find #'null '(1 2 3) 'sentinel))) | 173 | (should (seq-find #'null '(1 2 3) 'sentinel))) |
| 174 | 174 | ||
| 175 | ;; Hack to work around the ERT limitation that we can't reliably use | ||
| 176 | ;; `with-suppressed-warnings' inside an `ert-deftest'. (Bug#36568) | ||
| 177 | (defun seq--contains (&rest args) | ||
| 178 | (with-suppressed-warnings ((obsolete seq-contains)) | ||
| 179 | (apply #'seq-contains args))) | ||
| 180 | |||
| 175 | (ert-deftest test-seq-contains () | 181 | (ert-deftest test-seq-contains () |
| 176 | (with-test-sequences (seq '(3 4 5 6)) | 182 | (with-test-sequences (seq '(3 4 5 6)) |
| 177 | (should (seq-contains seq 3)) | 183 | (should (seq--contains seq 3)) |
| 178 | (should-not (seq-contains seq 7))) | 184 | (should-not (seq--contains seq 7))) |
| 179 | (with-test-sequences (seq '()) | 185 | (with-test-sequences (seq '()) |
| 180 | (should-not (seq-contains seq 3)) | 186 | (should-not (seq--contains seq 3)) |
| 181 | (should-not (seq-contains seq nil)))) | 187 | (should-not (seq--contains seq nil)))) |
| 182 | 188 | ||
| 183 | (ert-deftest test-seq-contains-should-return-the-elt () | 189 | (ert-deftest test-seq-contains-should-return-the-elt () |
| 184 | (with-test-sequences (seq '(3 4 5 6)) | 190 | (with-test-sequences (seq '(3 4 5 6)) |
| 185 | (should (= 5 (seq-contains seq 5))))) | 191 | (should (= 5 (seq--contains seq 5))))) |
| 186 | 192 | ||
| 187 | (ert-deftest test-seq-contains-p () | 193 | (ert-deftest test-seq-contains-p () |
| 188 | (with-test-sequences (seq '(3 4 5 6)) | 194 | (with-test-sequences (seq '(3 4 5 6)) |
| @@ -404,7 +410,7 @@ Evaluate BODY for each created sequence. | |||
| 404 | (let ((seq '(1 (2 (3 (4)))))) | 410 | (let ((seq '(1 (2 (3 (4)))))) |
| 405 | (seq-let (_ (_ (_ (a)))) seq | 411 | (seq-let (_ (_ (_ (a)))) seq |
| 406 | (should (= a 4)))) | 412 | (should (= a 4)))) |
| 407 | (let (seq) | 413 | (let ((seq nil)) |
| 408 | (seq-let (a b c) seq | 414 | (seq-let (a b c) seq |
| 409 | (should (null a)) | 415 | (should (null a)) |
| 410 | (should (null b)) | 416 | (should (null b)) |
| @@ -428,7 +434,7 @@ Evaluate BODY for each created sequence. | |||
| 428 | (seq '(1 (2 (3 (4)))))) | 434 | (seq '(1 (2 (3 (4)))))) |
| 429 | (seq-setq (_ (_ (_ (a)))) seq) | 435 | (seq-setq (_ (_ (_ (a)))) seq) |
| 430 | (should (= a 4))) | 436 | (should (= a 4))) |
| 431 | (let (seq a b c) | 437 | (let ((seq nil) a b c) |
| 432 | (seq-setq (a b c) seq) | 438 | (seq-setq (a b c) seq) |
| 433 | (should (null a)) | 439 | (should (null a)) |
| 434 | (should (null b)) | 440 | (should (null b)) |
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 69d59e84f6d..d8369506000 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el | |||
| @@ -169,13 +169,13 @@ | |||
| 169 | "no") | 169 | "no") |
| 170 | "no")) | 170 | "no")) |
| 171 | (should (equal | 171 | (should (equal |
| 172 | (let (z) | 172 | (let ((z nil)) |
| 173 | (if-let* (z (a 1) (b 2) (c 3)) | 173 | (if-let* (z (a 1) (b 2) (c 3)) |
| 174 | "yes" | 174 | "yes" |
| 175 | "no")) | 175 | "no")) |
| 176 | "no")) | 176 | "no")) |
| 177 | (should (equal | 177 | (should (equal |
| 178 | (let (d) | 178 | (let ((d nil)) |
| 179 | (if-let* ((a 1) (b 2) (c 3) d) | 179 | (if-let* ((a 1) (b 2) (c 3) d) |
| 180 | "yes" | 180 | "yes" |
| 181 | "no")) | 181 | "no")) |
| @@ -191,7 +191,7 @@ | |||
| 191 | 191 | ||
| 192 | (ert-deftest subr-x-test-if-let*-and-laziness-is-preserved () | 192 | (ert-deftest subr-x-test-if-let*-and-laziness-is-preserved () |
| 193 | "Test `if-let' respects `and' laziness." | 193 | "Test `if-let' respects `and' laziness." |
| 194 | (let (a-called b-called c-called) | 194 | (let ((a-called nil) (b-called nil) c-called) |
| 195 | (should (equal | 195 | (should (equal |
| 196 | (if-let* ((a nil) | 196 | (if-let* ((a nil) |
| 197 | (b (setq b-called t)) | 197 | (b (setq b-called t)) |
| @@ -199,7 +199,7 @@ | |||
| 199 | "yes" | 199 | "yes" |
| 200 | (list a-called b-called c-called)) | 200 | (list a-called b-called c-called)) |
| 201 | (list nil nil nil)))) | 201 | (list nil nil nil)))) |
| 202 | (let (a-called b-called c-called) | 202 | (let ((a-called nil) (b-called nil) c-called) |
| 203 | (should (equal | 203 | (should (equal |
| 204 | (if-let* ((a (setq a-called t)) | 204 | (if-let* ((a (setq a-called t)) |
| 205 | (b nil) | 205 | (b nil) |
| @@ -207,12 +207,12 @@ | |||
| 207 | "yes" | 207 | "yes" |
| 208 | (list a-called b-called c-called)) | 208 | (list a-called b-called c-called)) |
| 209 | (list t nil nil)))) | 209 | (list t nil nil)))) |
| 210 | (let (a-called b-called c-called) | 210 | (let ((a-called nil) (b-called nil) c-called) |
| 211 | (should (equal | 211 | (should (equal |
| 212 | (if-let* ((a (setq a-called t)) | 212 | (if-let* ((a (setq a-called t)) |
| 213 | (b (setq b-called t)) | 213 | (b (setq b-called t)) |
| 214 | (c nil) | 214 | (c nil) |
| 215 | (d (setq c-called t))) | 215 | (d (setq c-called t))) |
| 216 | "yes" | 216 | "yes" |
| 217 | (list a-called b-called c-called)) | 217 | (list a-called b-called c-called)) |
| 218 | (list t t nil))))) | 218 | (list t t nil))))) |
| @@ -329,12 +329,12 @@ | |||
| 329 | "no") | 329 | "no") |
| 330 | nil)) | 330 | nil)) |
| 331 | (should (equal | 331 | (should (equal |
| 332 | (let (z) | 332 | (let ((z nil)) |
| 333 | (when-let* (z (a 1) (b 2) (c 3)) | 333 | (when-let* (z (a 1) (b 2) (c 3)) |
| 334 | "no")) | 334 | "no")) |
| 335 | nil)) | 335 | nil)) |
| 336 | (should (equal | 336 | (should (equal |
| 337 | (let (d) | 337 | (let ((d nil)) |
| 338 | (when-let* ((a 1) (b 2) (c 3) d) | 338 | (when-let* ((a 1) (b 2) (c 3) d) |
| 339 | "no")) | 339 | "no")) |
| 340 | nil))) | 340 | nil))) |
| @@ -348,7 +348,7 @@ | |||
| 348 | 348 | ||
| 349 | (ert-deftest subr-x-test-when-let*-and-laziness-is-preserved () | 349 | (ert-deftest subr-x-test-when-let*-and-laziness-is-preserved () |
| 350 | "Test `when-let' respects `and' laziness." | 350 | "Test `when-let' respects `and' laziness." |
| 351 | (let (a-called b-called c-called) | 351 | (let ((a-called nil) (b-called nil) (c-called nil)) |
| 352 | (should (equal | 352 | (should (equal |
| 353 | (progn | 353 | (progn |
| 354 | (when-let* ((a nil) | 354 | (when-let* ((a nil) |
| @@ -357,7 +357,7 @@ | |||
| 357 | "yes") | 357 | "yes") |
| 358 | (list a-called b-called c-called)) | 358 | (list a-called b-called c-called)) |
| 359 | (list nil nil nil)))) | 359 | (list nil nil nil)))) |
| 360 | (let (a-called b-called c-called) | 360 | (let ((a-called nil) (b-called nil) (c-called nil)) |
| 361 | (should (equal | 361 | (should (equal |
| 362 | (progn | 362 | (progn |
| 363 | (when-let* ((a (setq a-called t)) | 363 | (when-let* ((a (setq a-called t)) |
| @@ -366,7 +366,7 @@ | |||
| 366 | "yes") | 366 | "yes") |
| 367 | (list a-called b-called c-called)) | 367 | (list a-called b-called c-called)) |
| 368 | (list t nil nil)))) | 368 | (list t nil nil)))) |
| 369 | (let (a-called b-called c-called) | 369 | (let ((a-called nil) (b-called nil) (c-called nil)) |
| 370 | (should (equal | 370 | (should (equal |
| 371 | (progn | 371 | (progn |
| 372 | (when-let* ((a (setq a-called t)) | 372 | (when-let* ((a (setq a-called t)) |
diff --git a/test/lisp/emacs-lisp/timer-tests.el b/test/lisp/emacs-lisp/timer-tests.el index 7856c217f9e..0f5b1a71868 100644 --- a/test/lisp/emacs-lisp/timer-tests.el +++ b/test/lisp/emacs-lisp/timer-tests.el | |||
| @@ -37,7 +37,8 @@ | |||
| 37 | (ert-deftest timer-tests-debug-timer-check () | 37 | (ert-deftest timer-tests-debug-timer-check () |
| 38 | ;; This function exists only if --enable-checking. | 38 | ;; This function exists only if --enable-checking. |
| 39 | (skip-unless (fboundp 'debug-timer-check)) | 39 | (skip-unless (fboundp 'debug-timer-check)) |
| 40 | (should (debug-timer-check))) | 40 | (when (fboundp 'debug-timer-check) ; silence byte-compiler |
| 41 | (should (debug-timer-check)))) | ||
| 41 | 42 | ||
| 42 | (ert-deftest timer-test-multiple-of-time () | 43 | (ert-deftest timer-test-multiple-of-time () |
| 43 | (should (time-equal-p | 44 | (should (time-equal-p |
diff --git a/test/lisp/format-spec-tests.el b/test/lisp/format-spec-tests.el index ff2abdeaad5..3c6fa540fe8 100644 --- a/test/lisp/format-spec-tests.el +++ b/test/lisp/format-spec-tests.el | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | 56 | ||
| 57 | (ert-deftest format-spec-do-flags-truncate () | 57 | (ert-deftest format-spec-do-flags-truncate () |
| 58 | "Test `format-spec--do-flags' truncation." | 58 | "Test `format-spec--do-flags' truncation." |
| 59 | (let (flags) | 59 | (let ((flags nil)) |
| 60 | (should (equal (format-spec--do-flags "" flags nil 0) "")) | 60 | (should (equal (format-spec--do-flags "" flags nil 0) "")) |
| 61 | (should (equal (format-spec--do-flags "" flags nil 1) "")) | 61 | (should (equal (format-spec--do-flags "" flags nil 1) "")) |
| 62 | (should (equal (format-spec--do-flags "a" flags nil 0) "")) | 62 | (should (equal (format-spec--do-flags "a" flags nil 0) "")) |
| @@ -75,7 +75,7 @@ | |||
| 75 | 75 | ||
| 76 | (ert-deftest format-spec-do-flags-pad () | 76 | (ert-deftest format-spec-do-flags-pad () |
| 77 | "Test `format-spec--do-flags' padding." | 77 | "Test `format-spec--do-flags' padding." |
| 78 | (let (flags) | 78 | (let ((flags nil)) |
| 79 | (should (equal (format-spec--do-flags "" flags 0 nil) "")) | 79 | (should (equal (format-spec--do-flags "" flags 0 nil) "")) |
| 80 | (should (equal (format-spec--do-flags "" flags 1 nil) " ")) | 80 | (should (equal (format-spec--do-flags "" flags 1 nil) " ")) |
| 81 | (should (equal (format-spec--do-flags "a" flags 0 nil) "a")) | 81 | (should (equal (format-spec--do-flags "a" flags 0 nil) "a")) |
diff --git a/test/lisp/ls-lisp-tests.el b/test/lisp/ls-lisp-tests.el index e3a75bed41d..9f2c63225b5 100644 --- a/test/lisp/ls-lisp-tests.el +++ b/test/lisp/ls-lisp-tests.el | |||
| @@ -54,7 +54,8 @@ | |||
| 54 | (kill-buffer buf) | 54 | (kill-buffer buf) |
| 55 | (setq buf (dired (nconc (list dir) files))) | 55 | (setq buf (dired (nconc (list dir) files))) |
| 56 | (should (looking-at "src")) | 56 | (should (looking-at "src")) |
| 57 | (next-line) ; File names must be aligned. | 57 | (with-suppressed-warnings ((interactive-only next-line)) |
| 58 | (next-line)) ; File names must be aligned. | ||
| 58 | (should (looking-at "src"))) | 59 | (should (looking-at "src"))) |
| 59 | (when (buffer-live-p buf) (kill-buffer buf))))) | 60 | (when (buffer-live-p buf) (kill-buffer buf))))) |
| 60 | 61 | ||
diff --git a/test/lisp/obsolete/cl-tests.el b/test/lisp/obsolete/cl-tests.el index 0e02e1ca1bc..0b8c1178f3a 100644 --- a/test/lisp/obsolete/cl-tests.el +++ b/test/lisp/obsolete/cl-tests.el | |||
| @@ -27,10 +27,15 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | ;; Hack to work around the ERT limitation that we can't reliably use | ||
| 31 | ;; `with-suppressed-warnings' inside an `ert-deftest'. (Bug#36568) | ||
| 32 | (defun cl-tests-labels-test () | ||
| 33 | (with-suppressed-warnings ((obsolete labels)) | ||
| 34 | (funcall (labels ((foo () t)) | ||
| 35 | #'foo)))) | ||
| 36 | |||
| 30 | (ert-deftest labels-function-quoting () | 37 | (ert-deftest labels-function-quoting () |
| 31 | "Test that #'foo does the right thing in `labels'." ; Bug#31792. | 38 | "Test that #'foo does the right thing in `labels'." ; Bug#31792. |
| 32 | (should (eq (funcall (labels ((foo () t)) | 39 | (should (eq (cl-tests-labels-test) t))) |
| 33 | #'foo)) | ||
| 34 | t))) | ||
| 35 | 40 | ||
| 36 | ;;; cl-tests.el ends here | 41 | ;;; cl-tests.el ends here |
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 63bae79bb40..9dc5e8cadcf 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el | |||
| @@ -438,7 +438,8 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 438 | ;; track down the problem. | 438 | ;; track down the problem. |
| 439 | (cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2) | 439 | (cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2) |
| 440 | "Doc string generic no-default xref-elisp-root-type." | 440 | "Doc string generic no-default xref-elisp-root-type." |
| 441 | "non-default for no-default") | 441 | "non-default for no-default" |
| 442 | (list this arg2)) ; silence byte-compiler | ||
| 442 | 443 | ||
| 443 | ;; defgeneric after defmethod in file to ensure the fallback search | 444 | ;; defgeneric after defmethod in file to ensure the fallback search |
| 444 | ;; method of just looking for the function name will fail. | 445 | ;; method of just looking for the function name will fail. |
| @@ -463,19 +464,23 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 463 | 464 | ||
| 464 | (cl-defmethod xref-elisp-generic-separate-default (arg1 arg2) | 465 | (cl-defmethod xref-elisp-generic-separate-default (arg1 arg2) |
| 465 | "Doc string generic separate-default default." | 466 | "Doc string generic separate-default default." |
| 466 | "separate default") | 467 | "separate default" |
| 468 | (list arg1 arg2)) ; silence byte-compiler | ||
| 467 | 469 | ||
| 468 | (cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2) | 470 | (cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2) |
| 469 | "Doc string generic separate-default xref-elisp-root-type." | 471 | "Doc string generic separate-default xref-elisp-root-type." |
| 470 | "non-default for separate-default") | 472 | "non-default for separate-default" |
| 473 | (list this arg2)) ; silence byte-compiler | ||
| 471 | 474 | ||
| 472 | (cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2) | 475 | (cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2) |
| 473 | "Doc string generic implicit-generic default." | 476 | "Doc string generic implicit-generic default." |
| 474 | "default for implicit generic") | 477 | "default for implicit generic" |
| 478 | (list arg1 arg2)) ; silence byte-compiler | ||
| 475 | 479 | ||
| 476 | (cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2) | 480 | (cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2) |
| 477 | "Doc string generic implicit-generic xref-elisp-root-type." | 481 | "Doc string generic implicit-generic xref-elisp-root-type." |
| 478 | "non-default for implicit generic") | 482 | "non-default for implicit generic" |
| 483 | (list this arg2)) ; silence byte-compiler | ||
| 479 | 484 | ||
| 480 | 485 | ||
| 481 | (xref-elisp-deftest find-defs-defgeneric-no-methods | 486 | (xref-elisp-deftest find-defs-defgeneric-no-methods |
| @@ -845,7 +850,8 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 845 | (if (stringp form) | 850 | (if (stringp form) |
| 846 | (insert form) | 851 | (insert form) |
| 847 | (pp form (current-buffer))) | 852 | (pp form (current-buffer))) |
| 848 | (font-lock-debug-fontify) | 853 | (with-suppressed-warnings ((interactive-only font-lock-debug-fontify)) |
| 854 | (font-lock-debug-fontify)) | ||
| 849 | (goto-char (point-min)) | 855 | (goto-char (point-min)) |
| 850 | (and (re-search-forward search nil t) | 856 | (and (re-search-forward search nil t) |
| 851 | (get-text-property (match-beginning 1) 'face)))) | 857 | (get-text-property (match-beginning 1) 'face)))) |
diff --git a/test/lisp/replace-tests.el b/test/lisp/replace-tests.el index 7f62a417a02..dcd5ebb1fe6 100644 --- a/test/lisp/replace-tests.el +++ b/test/lisp/replace-tests.el | |||
| @@ -599,11 +599,12 @@ bound to HIGHLIGHT-LOCUS." | |||
| 599 | (with-temp-buffer | 599 | (with-temp-buffer |
| 600 | (insert before) | 600 | (insert before) |
| 601 | (goto-char (point-min)) | 601 | (goto-char (point-min)) |
| 602 | (replace-regexp | 602 | (with-suppressed-warnings ((interactive-only replace-regexp)) |
| 603 | "\\(\\(L\\)\\|\\(R\\)\\)" | 603 | (replace-regexp |
| 604 | '(replace-eval-replacement | 604 | "\\(\\(L\\)\\|\\(R\\)\\)" |
| 605 | replace-quote | 605 | '(replace-eval-replacement |
| 606 | (if (match-string 2) "R" "L"))) | 606 | replace-quote |
| 607 | (if (match-string 2) "R" "L")))) | ||
| 607 | (should (equal (buffer-string) after))))) | 608 | (should (equal (buffer-string) after))))) |
| 608 | 609 | ||
| 609 | (ert-deftest test-count-matches () | 610 | (ert-deftest test-count-matches () |
diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index 9a7fb502d7c..932291afcc1 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el | |||
| @@ -24,6 +24,10 @@ | |||
| 24 | (require 'ert) | 24 | (require 'ert) |
| 25 | (require 'ses) | 25 | (require 'ses) |
| 26 | 26 | ||
| 27 | ;; Silence byte-compiler. | ||
| 28 | (with-suppressed-warnings ((lexical A2) (lexical A3)) | ||
| 29 | (defvar A2) | ||
| 30 | (defvar A3)) | ||
| 27 | 31 | ||
| 28 | ;; PLAIN FORMULA TESTS | 32 | ;; PLAIN FORMULA TESTS |
| 29 | ;; ====================================================================== | 33 | ;; ====================================================================== |
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e02de952f2f..063c6fe6a7b 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -926,6 +926,7 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." | |||
| 926 | (should-not (apropos-internal "^next-line$" #'keymapp))) | 926 | (should-not (apropos-internal "^next-line$" #'keymapp))) |
| 927 | 927 | ||
| 928 | 928 | ||
| 929 | (defvar test-global-boundp) | ||
| 929 | (ert-deftest test-buffer-local-boundp () | 930 | (ert-deftest test-buffer-local-boundp () |
| 930 | (let ((buf (generate-new-buffer "boundp"))) | 931 | (let ((buf (generate-new-buffer "boundp"))) |
| 931 | (with-current-buffer buf | 932 | (with-current-buffer buf |
diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el index 6964d423185..dd430cac2fd 100644 --- a/test/lisp/tar-mode-tests.el +++ b/test/lisp/tar-mode-tests.el | |||
| @@ -24,6 +24,12 @@ | |||
| 24 | (defvar tar-mode-tests-data-directory | 24 | (defvar tar-mode-tests-data-directory |
| 25 | (expand-file-name "test/data/decompress" source-directory)) | 25 | (expand-file-name "test/data/decompress" source-directory)) |
| 26 | 26 | ||
| 27 | ;; Hack to work around the ERT limitation that we can't reliably use | ||
| 28 | ;; `with-suppressed-warnings' inside an `ert-deftest'. (Bug#36568) | ||
| 29 | (defun tar-mode-tests--tar-grind-file-mode (&rest args) | ||
| 30 | (with-suppressed-warnings ((obsolete tar-grind-file-mode)) | ||
| 31 | (apply #'tar-grind-file-mode args))) | ||
| 32 | |||
| 27 | (ert-deftest tar-mode-test-tar-grind-file-mode () | 33 | (ert-deftest tar-mode-test-tar-grind-file-mode () |
| 28 | (let ((alist (list (cons 448 "rwx------") | 34 | (let ((alist (list (cons 448 "rwx------") |
| 29 | (cons 420 "rw-r--r--") | 35 | (cons 420 "rw-r--r--") |
| @@ -32,7 +38,7 @@ | |||
| 32 | (cons 1024 "-----S---") | 38 | (cons 1024 "-----S---") |
| 33 | (cons 2048 "--S------")))) | 39 | (cons 2048 "--S------")))) |
| 34 | (dolist (x alist) | 40 | (dolist (x alist) |
| 35 | (should (equal (cdr x) (tar-grind-file-mode (car x))))))) | 41 | (should (equal (cdr x) (tar-mode-tests--tar-grind-file-mode (car x))))))) |
| 36 | 42 | ||
| 37 | (ert-deftest tar-mode-test-tar-extract-gz () | 43 | (ert-deftest tar-mode-test-tar-extract-gz () |
| 38 | (skip-unless (executable-find "gzip")) | 44 | (skip-unless (executable-find "gzip")) |
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index dfc12735bda..8cc271b9e1c 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -433,26 +433,27 @@ comparing the subr with a much slower Lisp implementation." | |||
| 433 | ;; More specifically, test the problem seen in bug#41029 where setting | 433 | ;; More specifically, test the problem seen in bug#41029 where setting |
| 434 | ;; the default value of a variable takes time proportional to the | 434 | ;; the default value of a variable takes time proportional to the |
| 435 | ;; number of buffers. | 435 | ;; number of buffers. |
| 436 | (let* ((fun #'error) | 436 | (when (fboundp 'current-cpu-time) ; silence byte-compiler |
| 437 | (test (lambda () | 437 | (let* ((fun #'error) |
| 438 | (with-temp-buffer | 438 | (test (lambda () |
| 439 | (let ((st (car (current-cpu-time)))) | 439 | (with-temp-buffer |
| 440 | (dotimes (_ 1000) | 440 | (let ((st (car (current-cpu-time)))) |
| 441 | (let ((case-fold-search 'data-test)) | 441 | (dotimes (_ 1000) |
| 442 | ;; Use an indirection through a mutable var | 442 | (let ((case-fold-search 'data-test)) |
| 443 | ;; to try and make sure the byte-compiler | 443 | ;; Use an indirection through a mutable var |
| 444 | ;; doesn't optimize away the let bindings. | 444 | ;; to try and make sure the byte-compiler |
| 445 | (funcall fun))) | 445 | ;; doesn't optimize away the let bindings. |
| 446 | ;; FIXME: Handle the wraparound, if any. | 446 | (funcall fun))) |
| 447 | (- (car (current-cpu-time)) st))))) | 447 | ;; FIXME: Handle the wraparound, if any. |
| 448 | (_ (setq fun #'ignore)) | 448 | (- (car (current-cpu-time)) st))))) |
| 449 | (time1 (funcall test)) | 449 | (_ (setq fun #'ignore)) |
| 450 | (bufs (mapcar (lambda (_) (generate-new-buffer " data-test")) | 450 | (time1 (funcall test)) |
| 451 | (make-list 1000 nil))) | 451 | (bufs (mapcar (lambda (_) (generate-new-buffer " data-test")) |
| 452 | (time2 (funcall test))) | 452 | (make-list 1000 nil))) |
| 453 | (mapc #'kill-buffer bufs) | 453 | (time2 (funcall test))) |
| 454 | ;; Don't divide one time by the other since they may be 0. | 454 | (mapc #'kill-buffer bufs) |
| 455 | (should (< time2 (* time1 5))))) | 455 | ;; Don't divide one time by the other since they may be 0. |
| 456 | (should (< time2 (* time1 5)))))) | ||
| 456 | 457 | ||
| 457 | ;; More tests to write - | 458 | ;; More tests to write - |
| 458 | ;; kill-local-variable | 459 | ;; kill-local-variable |
diff --git a/test/src/search-tests.el b/test/src/search-tests.el index b7b4ab9a8ff..b5f4730f265 100644 --- a/test/src/search-tests.el +++ b/test/src/search-tests.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | (setq ov-set (make-overlay 3 5)) | 28 | (setq ov-set (make-overlay 3 5)) |
| 29 | (overlay-put | 29 | (overlay-put |
| 30 | ov-set 'modification-hooks | 30 | ov-set 'modification-hooks |
| 31 | (list (lambda (o after &rest _args) | 31 | (list (lambda (_o after &rest _args) |
| 32 | (when after | 32 | (when after |
| 33 | (let ((inhibit-modification-hooks t)) | 33 | (let ((inhibit-modification-hooks t)) |
| 34 | (save-excursion | 34 | (save-excursion |