[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste e998ee4 099/298: Simplify one unit test
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste e998ee4 099/298: Simplify one unit test |
Date: |
Thu, 9 Dec 2021 18:59:52 -0500 (EST) |
branch: elpa/webpaste
commit e998ee4f9b3effa155fc176605549d814ca0fef5
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Simplify one unit test
This was the first test I wrote, which also tested provider
priority. But now I have separate tests for provider priority so it
didn't need to be as complex anymore.
---
test/webpaste-test.el | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git a/test/webpaste-test.el b/test/webpaste-test.el
index df704e5..8bbd4b0 100644
--- a/test/webpaste-test.el
+++ b/test/webpaste-test.el
@@ -4,6 +4,8 @@
(require 'ert)
(require 'webpaste)
+
+
(ert-deftest webpaste--autopupulate-provider-priority ()
"Test autopopulate of webpaste-provider-priority."
@@ -17,6 +19,7 @@
'("provider1" "provider2" "provider3"))))
+
(ert-deftest webpaste--static-provider-priority ()
"Test static configuration of webpaste-provider-priority."
@@ -28,6 +31,7 @@
'("provider2" "provider1" "provider3"))))
+
(ert-deftest webpaste--callback-from-working-provider ()
"This test just sends a message to a good provider that just works."
@@ -52,6 +56,7 @@
(should (string= returned-result "Works: test-string"))))
+
(ert-deftest webpaste--callback-from-working-provider-as-fallback ()
"This test sends a message to a bad provider that returns some error data.
@@ -64,44 +69,29 @@ result from the good provider only."
(setq-default webpaste-tested-providers nil)
(setq-default webpaste-provider-priority nil)
- ;; Make two broken providers that "returns" the result by setting the
- ;; variable and then failover.
- ;; Also make two working providers that returns different messages so the
- ;; test can detect which provider was used easily.
+ ;; Creates a "broken" provider that will call on the next provider due to a
+ ;; faked failure and checks that the next provider is picked up correctly.
(setq-default webpaste-providers-alist
- (list (list "brokenprovider1"
+ (list (list "brokenprovider"
(lambda (text)
;; Set return text
(setq returned-result
- (concat "Broken1: " text))
+ (concat "Broken: " text))
;; Call paste again
(webpaste-paste-text text)))
- (list "workingprovider1"
- (lambda (text)
- (setq returned-result
- (concat "Works1: " text))))
-
- (list "workingprovider2"
+ (list "workingprovider"
(lambda (text)
(setq returned-result
- (concat "Works2: " text))))
-
- (list "brokenprovider2"
- (lambda (text)
- ;; Set return text
- (setq returned-result
- (concat "Broken2: " text))
-
- ;; Call paste again
- (webpaste-paste-text text)))))
+ (concat "Working: " text))))))
;; Call webpaste
(webpaste-paste-text "test-string")
;; Check that we got the expected result
- (should (string= returned-result "Works1: test-string"))))
+ (should (string= returned-result "Working: test-string"))))
+
(provide 'webpaste-test)
- [nongnu] elpa/webpaste 80f0afe 051/298: Added provider to todo-list, (continued)
- [nongnu] elpa/webpaste 80f0afe 051/298: Added provider to todo-list, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste cb9cca7 054/298: Stop moving point and remove usage of save-excursion and therefore, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2250993 061/298: Fix eval of macros, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste c60c712 062/298: Checkdoc, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 39809d8 063/298: Update documentation, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste c57cd53 071/298: Changed string to number, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 78651c9 073/298: Avoid using eval, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste c9d1de0 076/298: Added Makefile for running tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7770c88 080/298: Added first unit test to detect a working provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 20760ac 097/298: Set default value of :parser to provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e998ee4 099/298: Simplify one unit test,
ELPA Syncer <=
- [nongnu] elpa/webpaste e905bbc 066/298: Change value-type to catch-all sexp since it's not functions anymore, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b4c08a5 070/298: Spelling in docs, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste dc11b51 078/298: Added code for helper for unit tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8e9f4e0 094/298: Bump required version for webpaste.el because I can't install older, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0b7ba72 098/298: Added coveralls for file coverage testing, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 25ea405 103/298: Added ERT test for message when returning URL, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste f221c1a 104/298: Added test for pasting entire buffers and regions, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste acf9676 108/298: Added flag to disable failover for provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4867c58 113/298: Backquotes for compacter list, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8f37214 116/298: Update docs to match function, ELPA Syncer, 2021/12/09