aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2017-05-16 21:09:58 +0100
committerJohnson Denen <johnson.denen@gmail.com>2017-05-18 10:21:21 -0400
commitfe8e4386eacb358df0e16dc5bd37dde4f4d6d57c (patch)
tree2329c867ca4d8434e6e2200aae4f827e7f2a9165 /test
parent5f41086d3a03e8781aab77ab17f4d4f95263e07c (diff)
Remove most byte-compile warnings.
We do this by - moving vars into the files where they are (mostly) used - "declaring" vars used elsewhere with the (defvar <var-name>) pattern, - declaring functions defined in others functions rather than loading the file via require.
Diffstat (limited to 'test')
-rw-r--r--test/mastodon-client-tests.el10
-rw-r--r--test/mastodon-media-tests.el20
-rw-r--r--test/mastodon-tl-tests.el16
3 files changed, 23 insertions, 23 deletions
diff --git a/test/mastodon-client-tests.el b/test/mastodon-client-tests.el
index e1f92f8..c339efa 100644
--- a/test/mastodon-client-tests.el
+++ b/test/mastodon-client-tests.el
@@ -54,22 +54,22 @@
(ert-deftest client-1 ()
"Should return `mastondon-client' if non-nil."
- (let ((mastodon-client t))
+ (let ((mastodon-client--client-details t))
(should (eq (mastodon-client) t))))
(ert-deftest client-2 ()
"Should read from `mastodon-token-file' if available."
- (let ((mastodon-client nil))
+ (let ((mastodon-client--client-details nil))
(with-mock
(mock (mastodon-client--read) => '(:client_id "foo" :client_secret "bar"))
(should (equal (mastodon-client) '(:client_id "foo" :client_secret "bar")))
- (should (equal mastodon-client '(:client_id "foo" :client_secret "bar"))))))
+ (should (equal mastodon-client--client-details '(:client_id "foo" :client_secret "bar"))))))
(ert-deftest client-3 ()
"Should store client data in plstore if it can't be read."
- (let ((mastodon-client nil))
+ (let ((mastodon-client--client-details nil))
(with-mock
(mock (mastodon-client--read))
(mock (mastodon-client--store) => '(:client_id "foo" :client_secret "baz"))
(should (equal (mastodon-client) '(:client_id "foo" :client_secret "baz")))
- (should (equal mastodon-client '(:client_id "foo" :client_secret "baz"))))))
+ (should (equal mastodon-client--client-details '(:client_id "foo" :client_secret "baz"))))))
diff --git a/test/mastodon-media-tests.el b/test/mastodon-media-tests.el
index 9cd06b7..4bb89c7 100644
--- a/test/mastodon-media-tests.el
+++ b/test/mastodon-media-tests.el
@@ -6,7 +6,7 @@
(mock (image-type-available-p 'imagemagick) => t)
(mock (create-image * 'imagemagick t :height 123) => :mock-image)
- (let* ((mastodon-avatar-height 123)
+ (let* ((mastodon-media--avatar-height 123)
(result (mastodon-media--get-avatar-rendering "http://example.org/img.png"))
(result-no-properties (substring-no-properties result))
(properties (text-properties-at 0 result)))
@@ -21,7 +21,7 @@
(with-mock
(mock (create-image * nil t) => :mock-image)
- (let* ((mastodon-preview-max-height 123)
+ (let* ((mastodon-media--preview-max-height 123)
(result (mastodon-media--get-media-link-rendering "http://example.org/img.png"))
(result-no-properties (substring-no-properties result))
(properties (text-properties-at 0 result)))
@@ -34,7 +34,7 @@
(ert-deftest mastodon-media:load-image-from-url:avatar-with-imagemagic ()
"Should make the right call to url-retrieve."
(let ((url "http://example.org/image.png")
- (mastodon-avatar-height 123))
+ (mastodon-media--avatar-height 123))
(with-mock
(mock (image-type-available-p 'imagemagick) => t)
(mock (create-image * 'imagemagick t :height 123) => '(image foo))
@@ -42,7 +42,7 @@
(mock (url-retrieve
url
#'mastodon-media--process-image-response
- '(:my-marker (:height 123) 1 "http://example.org/image.png"))
+ '(:my-marker (:height 123) 1))
=> :called-as-expected)
(with-temp-buffer
@@ -62,7 +62,7 @@
(mock (url-retrieve
url
#'mastodon-media--process-image-response
- '(:my-marker () 1 "http://example.org/image.png"))
+ '(:my-marker () 1))
=> :called-as-expected)
(with-temp-buffer
@@ -82,13 +82,13 @@
(mock (url-retrieve
"http://example.org/image.png"
#'mastodon-media--process-image-response
- '(:my-marker (:max-height 321) 5 "http://example.org/image.png"))
+ '(:my-marker (:max-height 321) 5))
=> :called-as-expected)
(with-temp-buffer
(insert (concat "Start:"
(mastodon-media--get-media-link-rendering url)
":rest"))
- (let ((mastodon-preview-max-height 321))
+ (let ((mastodon-media--preview-max-height 321))
(should (eq :called-as-expected (mastodon-media--load-image-from-url url 'media-link 7 5))))))))
(ert-deftest mastodon-media:load-image-from-url:media-link-without-imagemagic ()
@@ -101,14 +101,14 @@
(mock (url-retrieve
"http://example.org/image.png"
#'mastodon-media--process-image-response
- '(:my-marker () 5 "http://example.org/image.png"))
+ '(:my-marker () 5))
=> :called-as-expected)
(with-temp-buffer
(insert (concat "Start:"
(mastodon-media--get-avatar-rendering url)
":rest"))
- (let ((mastodon-preview-max-height 321))
+ (let ((mastodon-media--preview-max-height 321))
(should (eq :called-as-expected (mastodon-media--load-image-from-url url 'media-link 7 5))))))))
(ert-deftest mastodon-media:process-image-response ()
@@ -134,7 +134,7 @@
(mock (create-image "fake\nimage\ndata" 'imagemagick t ':image :option) => :fake-image)
- (mastodon-media--process-image-response () used-marker '(:image :option) 1 "the-url")
+ (mastodon-media--process-image-response () used-marker '(:image :option) 1)
;; the used marker has been unset:
(should (null (marker-position used-marker)))
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index caea476..8c706f5 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -105,7 +105,7 @@
(ert-deftest mastodon-tl--byline-regular ()
"Should format the regular toot correctly."
- (let ((mastodon-media-show-avatars-p nil)
+ (let ((mastodon-tl--show-avatars-p nil)
(timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot))))
(with-mock
(mock (date-to-time timestamp) => '(22782 21551))
@@ -119,7 +119,7 @@
(ert-deftest mastodon-tl--byline-regular-with-avatar ()
"Should format the regular toot correctly."
- (let ((mastodon-media-show-avatars-p t)
+ (let ((mastodon-tl--show-avatars-p t)
(timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot))))
(with-mock
(stub create-image => '(image "fake data"))
@@ -134,7 +134,7 @@
(ert-deftest mastodon-tl--byline-boosted ()
"Should format the boosted toot correctly."
- (let* ((mastodon-media-show-avatars-p nil)
+ (let* ((mastodon-tl--show-avatars-p nil)
(toot (cons '(reblogged . t) mastodon-tl-test-base-toot))
(timestamp (cdr (assoc 'created_at toot))))
(with-mock
@@ -148,7 +148,7 @@
(ert-deftest mastodon-tl--byline-favorited ()
"Should format the favourited toot correctly."
- (let* ((mastodon-media-show-avatars-p nil)
+ (let* ((mastodon-tl--show-avatars-p nil)
(toot (cons '(favourited . t) mastodon-tl-test-base-toot))
(timestamp (cdr (assoc 'created_at toot))))
(with-mock
@@ -163,7 +163,7 @@
(ert-deftest mastodon-tl--byline-boosted/favorited ()
"Should format the boosted & favourited toot correctly."
- (let* ((mastodon-media-show-avatars-p nil)
+ (let* ((mastodon-tl--show-avatars-p nil)
(toot `((favourited . t) (reblogged . t) ,@mastodon-tl-test-base-toot))
(timestamp (cdr (assoc 'created_at toot))))
(with-mock
@@ -177,7 +177,7 @@
(ert-deftest mastodon-tl--byline-reblogged ()
"Should format the reblogged toot correctly."
- (let* ((mastodon-media-show-avatars-p nil)
+ (let* ((mastodon-tl--show-avatars-p nil)
(toot mastodon-tl-test-base-boosted-toot)
(original-toot (cdr (assoc 'reblog mastodon-tl-test-base-boosted-toot)))
(timestamp (cdr (assoc 'created_at toot)))
@@ -197,7 +197,7 @@
(ert-deftest mastodon-tl--byline-reblogged-with-avatars ()
"Should format the reblogged toot correctly."
- (let* ((mastodon-media-show-avatars-p t)
+ (let* ((mastodon-tl--show-avatars-p t)
(toot mastodon-tl-test-base-boosted-toot)
(original-toot (cdr (assoc 'reblog mastodon-tl-test-base-boosted-toot)))
(timestamp (cdr (assoc 'created_at toot)))
@@ -218,7 +218,7 @@
(ert-deftest mastodon-tl--byline-reblogged-boosted/favorited ()
"Should format the reblogged toot that was also boosted & favoritedcorrectly."
- (let* ((mastodon-media-show-avatars-p nil)
+ (let* ((mastodon-tl--show-avatars-p nil)
(toot `((favourited . t) (reblogged . t) ,@mastodon-tl-test-base-boosted-toot))
(original-toot (cdr (assoc 'reblog mastodon-tl-test-base-boosted-toot)))
(timestamp (cdr (assoc 'created_at toot)))