[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste db8c605 154/298: Rewrite test to cover both if li
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste db8c605 154/298: Rewrite test to cover both if link is opened in external browser or not |
Date: |
Thu, 9 Dec 2021 19:00:04 -0500 (EST) |
branch: elpa/webpaste
commit db8c6050cb216a444b03e51f5cd786769850acb6
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Rewrite test to cover both if link is opened in external browser or not
---
test/webpaste-test.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/test/webpaste-test.el b/test/webpaste-test.el
index 7a0f0ec..bf49352 100644
--- a/test/webpaste-test.el
+++ b/test/webpaste-test.el
@@ -89,13 +89,28 @@
(ert-deftest webpaste-test/return-url ()
"Test returning of URL's to the user."
- ;; Test to return a link and check that the message logged is the expected
one
- (should (equal
- (webpaste-return-url "https://example.com/")
- "Added \"https://example.com/\" to kill ring."))
+ ;; Override browse-url-generic to set a variable to t if triggered
+ (cl-letf (((symbol-function 'browse-url-generic)
+ (lambda (url) (setq webpaste-test/opened-in-browser t))))
- ;; Check so the kill ring contain the correct contents
- (should (equal (car kill-ring) "https://example.com/")))
+ ;; Test to return a link and check that the message logged is the one we
expect
+ (let ((webpaste/open-in-browser nil)(webpaste-test/opened-in-browser nil))
+ (should (equal
+ (webpaste-return-url "https://example.com/")
+ "Added \"https://example.com/\" to kill ring."))
+
+ ;; Check so the kill ring contain the correct contents
+ (should (equal (car kill-ring) "https://example.com/"))
+
+ ;; Check so the link wasn't opened in a browser
+ (should (equal webpaste-test/opened-in-browser nil)))
+
+ ;; Test that we call browse-url-generic with the link if option to open in
+ ;; browser is set
+ (let ((webpaste/open-in-browser t)(webpaste-test/opened-in-browser nil))
+ (webpaste-return-url "https://example.com/")
+
+ (should (equal webpaste-test/opened-in-browser t)))))
- [nongnu] elpa/webpaste 0e4ac51 132/298: Added support for buffer-language depending on mode for some providers, (continued)
- [nongnu] elpa/webpaste 0e4ac51 132/298: Added support for buffer-language depending on mode for some providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9ddc617 133/298: Simplify webpaste/get-lang-alist-with-overrides implementation, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste f08a2dc 136/298: Rename internal variable, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste af0474e 139/298: Merge branch 'naclander-master', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b9b2ce0 143/298: Added support for languages for providers that appends language to the URL, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste c091dab 146/298: Change some types based on actual use, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0144016 147/298: Remove unused variable, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b5491ab 150/298: Bump version for stable release, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 29d10d7 151/298: Added paste.pound-python.org as provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 410e286 152/298: Added webpaste confirmation tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste db8c605 154/298: Rewrite test to cover both if link is opened in external browser or not,
ELPA Syncer <=
- [nongnu] elpa/webpaste 6b93c89 153/298: Merge branch 'naclander-master', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d2ed48a 156/298: Added unit test for appending of language to returning links, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 899e08e 157/298: Change install method of emacs in travis for faster build times, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e87a37c 158/298: Switched from ert to buttercup for testing, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 865ff10 159/298: Disable this test for now since it breaks, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 59fd22f 161/298: Merge branch 'naclander-POST-bug', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d475f02 170/298: Added integration test for ptpb.pw, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 95de0b8 169/298: Remove sync as a provider parameter on creation and add it on execution, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste fd4332a 172/298: Merge branch 'test-providers-on-travis', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 60c0a98 167/298: Added printing of travis event type, ELPA Syncer, 2021/12/09