Added test for pasting entire buffers and regions

master
Elis Axelsson 9 years ago
parent 25ea405478
commit f221c1accd
No known key found for this signature in database
GPG Key ID: D57EFA625C9A925F
  1. 24
      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."

Loading…
Cancel
Save