emacs-detubifier

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c39c60828965ceb085739dc4319d61b4ad31ba67
parent ea40040b01d7669168a2c169e2bb91d83ce662dc
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri, 27 Sep 2024 09:45:41 +0300

Add some tests using ERT (Emacs Regression Testing).

Diffstat:
Mdetubifier.el | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+), 0 deletions(-)

diff --git a/detubifier.el b/detubifier.el @@ -201,5 +201,62 @@ is replaced with: 'detubifier-detubify-top-kill "2024-09-25") + +(ert-deftest test-detubifier-farsidify-string () + "Test `detubifier-farsidify-string'." + (should (equal (detubifier-farsidify-string "sdfljdsf sdfkjl https://youtube.com/moo +https://twitter.com/blah") + (concat "sdfljdsf sdfkjl " + detubifier-farside-url + "https://youtube.com/moo +" + detubifier-farside-url + "https://twitter.com/blah")))) + +(ert-deftest test-detubifier-farsidify-region () + "Test `detubifier-farsidify-region'." + (with-temp-buffer + (insert "sdfljdsf sdfkjl https://youtube.com/moo +https://twitter.com/blah") + (detubifier-farsidify-region (point-min) + (point-max)) + (should (equal (buffer-substring (point-min) + (point-max)) + (concat "sdfljdsf sdfkjl " + detubifier-farside-url + "https://youtube.com/moo +" + detubifier-farside-url + "https://twitter.com/blah"))))) + +(ert-deftest test-detubifier-custom-detubify-string () + "Test `detubifier-custom-detubify-string'. + +TODO: Test only works with the default `detubifier-regexp-replacement-pairs'. +Make it work in general!" + (should (equal (detubifier-custom-detubify-string "sdfljdsf sdfkjl https://youtube.com/moo +https://twitter.com/blah") + (concat "sdfljdsf sdfkjl https://invidious.jing.rocks/moo +https://nitter.poast.org/blah")))) + +(ert-deftest test-detubifier-farsidify-region () + "Test `detubifier-custom-detubify-region'. + +TODO: Test only works with the default `detubifier-regexp-replacement-pairs'. +Make it work in general!" + (with-temp-buffer + (insert "sdfljdsf sdfkjl https://youtube.com/moo +https://twitter.com/blah") + (detubifier-farsidify-region (point-min) + (point-max)) + (should (equal (buffer-substring (point-min) + (point-max)) + (concat "sdfljdsf sdfkjl " + detubifier-farside-url + "https://youtube.com/moo +" + detubifier-farside-url + "https://twitter.com/blah"))))) + (provide 'detubifier) ;;; detubifier.el ends here