(when (copyright-re-search regexp (copyright-limit) t)
;; We may accidentally have landed in the middle of a
;; copyright line, so re-perform the search without the
- ;; search. (Otherwise we may be inserting the new year in the
+ ;; limit. (Otherwise we may be inserting the new year in the
;; middle of the list of years.)
(goto-char (match-beginning 0))
(copyright-re-search regexp nil t)))))
(dolist (test copyright-tests--data)
(with-copyright-test (car test) (cdr test))))
+(ert-deftest test-end-chop ()
+ (should
+ (equal
+ (with-temp-buffer
+ (let ((copyright-query nil))
+ (insert (make-string (- copyright-limit 14) ?x) "\n"
+ "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
+ (copyright-update)
+ (buffer-substring (- (point-max) 42) (point-max))))
+ "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
+
(provide 'copyright-tests)
;;; copyright-tests.el ends here