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

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

[nongnu] elpa/webpaste f221c1a 104/298: Added test for pasting entire bu


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste f221c1a 104/298: Added test for pasting entire buffers and regions
Date: Thu, 9 Dec 2021 18:59:53 -0500 (EST)

branch: elpa/webpaste
commit f221c1accd4faaf595b693d41e04341f89a6e9d5
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    Added test for pasting entire buffers and regions
---
 test/webpaste-test.el | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/webpaste-test.el b/test/webpaste-test.el
index d9cfe42..5c54bbd 100644
--- a/test/webpaste-test.el
+++ b/test/webpaste-test.el
@@ -2,10 +2,34 @@
 ;;; Commentary:
 ;;; Code:
 (require 'ert)
+(require 'cl-lib)
 (require 'webpaste)
 
 
 
+(ert-deftest webpaste-test/paste-region-and-buffer ()
+  "Test pasting of regions and buffers."
+
+  ;; Override pasting function to just return the inserted string
+  (cl-letf (((symbol-function 'webpaste-paste-text)
+             (lambda (text) text)))
+
+    ;; Set up a temporary buffer
+    (with-temp-buffer
+      ;; With README as content
+      (insert-file-contents "README.org")
+
+      ;; And make sure that the paste buffer function returns the same as we 
had
+      ;; in the buffer.
+      (should (equal (webpaste-paste-buffer) (buffer-string)))
+
+      ;; 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))))))
+
+
+
 (ert-deftest webpaste-test/return-url ()
   "Test returning of URL's to the user."
 



reply via email to

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