emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste 410e286 152/298: Added webpaste confirmation test


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste 410e286 152/298: Added webpaste confirmation tests
Date: Thu, 9 Dec 2021 19:00:04 -0500 (EST)

branch: elpa/webpaste
commit 410e286464b7f20c9a87d52cbaa268293f20afbb
Author: Nathan Aclander <naclander@linux.ucla.edu>
Commit: Nathan Aclander <naclander@linux.ucla.edu>

    Added webpaste confirmation tests
---
 test/webpaste-test.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/test/webpaste-test.el b/test/webpaste-test.el
index 056735a..7a0f0ec 100644
--- a/test/webpaste-test.el
+++ b/test/webpaste-test.el
@@ -63,7 +63,26 @@
       ;; Test so webpaste-paste-region selects the same part of the buffer as 
to
       ;; be expected.
       (should (equal (webpaste-paste-region 10 100)
-                     (buffer-substring 10 100))))))
+                     (buffer-substring 10 100)))
+
+      ;; Test when wanting a paste confirmation
+      (let ((webpaste/paste-confirmation t))
+
+        ;; Override yes-or-no-p to immitate "yes" response
+        (cl-letf (((symbol-function 'yes-or-no-p) (lambda (text) t)))
+
+          (should (equal (webpaste-paste-buffer) (buffer-string)))
+
+          (should (equal (webpaste-paste-region 10 100)
+                         (buffer-substring 10 100))))
+
+        ;; Override yes-or-no-p to immitate "no" response
+        (cl-letf (((symbol-function 'yes-or-no-p) (lambda (text) nil)))
+
+          (should (not (equal (webpaste-paste-buffer) (buffer-string))))
+
+          (should (not (equal (webpaste-paste-region 10 100)
+                                 (buffer-substring 10 100)))))))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]