From 949912d793cc8b80e6acb0978268405dc21a13e9 Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Sat, 22 Apr 2017 22:33:58 -0400 Subject: Use Cask to run tests in TravisCI --- .gitignore | 2 ++ .travis.yml | 12 ++++++++++++ Cask | 9 +++++++++ fixture/client.plstore | 2 ++ fixture/empty.plstore | 2 ++ lisp/mastodon.el | 2 +- test/ert-helper.el | 6 ++++++ test/fixture/client.plstore | 2 -- test/fixture/empty.plstore | 2 -- test/mastodon-auth-tests.el | 4 ---- test/mastodon-client-tests.el | 1 - test/mastodon-http-tests.el | 2 -- test/mastodon-tl-tests.el | 1 - test/mastodon-toot-tests.el | 1 - 14 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 .travis.yml create mode 100644 Cask create mode 100644 fixture/client.plstore create mode 100644 fixture/empty.plstore create mode 100644 test/ert-helper.el delete mode 100644 test/fixture/client.plstore delete mode 100644 test/fixture/empty.plstore diff --git a/.gitignore b/.gitignore index 45b434e..d72aa13 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ # Other .DS_Store stubfile.plstore +*~ +dist/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0948dbd --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: emacs-lisp +sudo: false +before_install: + - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh + - evm install $EVM_EMACS --use --skip + - cask install +env: + - EVM_EMACS=emacs-24.5-travis + - EVM_EMACS=emacs-25.1-travis +script: + - emacs --version + - cask exec ert-runner -l test/ert-helper.el test/*-tests.el diff --git a/Cask b/Cask new file mode 100644 index 0000000..82380d2 --- /dev/null +++ b/Cask @@ -0,0 +1,9 @@ +(source gnu) +(source melpa) + +(package "mastodon" "0.4.2" "Emacs client for Mastodon") +(files "lisp/*.el") + +(development + (depends-on "ert-runner") + (depends-on "el-mock")) diff --git a/fixture/client.plstore b/fixture/client.plstore new file mode 100644 index 0000000..3514ed9 --- /dev/null +++ b/fixture/client.plstore @@ -0,0 +1,2 @@ +;;; public entries -*- mode: plstore -*- +(("mastodon" :client_id "id" :client_secret "secret")) diff --git a/fixture/empty.plstore b/fixture/empty.plstore new file mode 100644 index 0000000..4685e78 --- /dev/null +++ b/fixture/empty.plstore @@ -0,0 +1,2 @@ +;;; public entries -*- mode: plstore -*- +(("ignore" :client_id "id" :client_secret "secret")) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 1332c7b..a2006f8 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -1,4 +1,4 @@ -;;; mastodon.el -- Mastodon client for Emacs +;;; mastodon.el --- Mastodon client for Emacs ;; Copyright (C) 2017 Johnson Denen ;; Author: Johnson Denen diff --git a/test/ert-helper.el b/test/ert-helper.el new file mode 100644 index 0000000..53111d7 --- /dev/null +++ b/test/ert-helper.el @@ -0,0 +1,6 @@ +(load-file "lisp/mastodon-http.el") +(load-file "lisp/mastodon-client.el") +(load-file "lisp/mastodon-auth.el") +(load-file "lisp/mastodon-toot.el") +(load-file "lisp/mastodon-tl.el") + diff --git a/test/fixture/client.plstore b/test/fixture/client.plstore deleted file mode 100644 index 3514ed9..0000000 --- a/test/fixture/client.plstore +++ /dev/null @@ -1,2 +0,0 @@ -;;; public entries -*- mode: plstore -*- -(("mastodon" :client_id "id" :client_secret "secret")) diff --git a/test/fixture/empty.plstore b/test/fixture/empty.plstore deleted file mode 100644 index 4685e78..0000000 --- a/test/fixture/empty.plstore +++ /dev/null @@ -1,2 +0,0 @@ -;;; public entries -*- mode: plstore -*- -(("ignore" :client_id "id" :client_secret "secret")) diff --git a/test/mastodon-auth-tests.el b/test/mastodon-auth-tests.el index 1bbc46b..b3edea8 100644 --- a/test/mastodon-auth-tests.el +++ b/test/mastodon-auth-tests.el @@ -1,9 +1,5 @@ (require 'el-mock) -(load-file "../lisp/mastodon.el") -(load-file "../lisp/mastodon-http.el") -(load-file "../lisp/mastodon-auth.el") - (ert-deftest mastodon-auth:token-file () "Should return `mastodon-token-file' value." (should (string= (mastodon-auth--token-file) "~/.emacs.d/mastodon.plstore"))) diff --git a/test/mastodon-client-tests.el b/test/mastodon-client-tests.el index 2a58b84..73a3d7e 100644 --- a/test/mastodon-client-tests.el +++ b/test/mastodon-client-tests.el @@ -1,5 +1,4 @@ (require 'el-mock) -(load-file "../lisp/mastodon-client.el") (ert-deftest register () "Should POST to /apps." diff --git a/test/mastodon-http-tests.el b/test/mastodon-http-tests.el index 55f6bf3..06b92d5 100644 --- a/test/mastodon-http-tests.el +++ b/test/mastodon-http-tests.el @@ -1,7 +1,5 @@ (require 'el-mock) -(load-file "../lisp/mastodon-http.el") - (ert-deftest mastodon-http:get:retrieves-endpoint () "Should make a `url-retrieve' of the given URL." (let ((callback-double (lambda () "double"))) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 5571e70..19d7e55 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -1,5 +1,4 @@ (require 'el-mock) -(load-file "../lisp/mastodon-tl.el") (ert-deftest mastodon-tl:from-toot () "Should return the value for KEY in a list." diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el index cdd3bb9..eae9e89 100644 --- a/test/mastodon-toot-tests.el +++ b/test/mastodon-toot-tests.el @@ -1,5 +1,4 @@ (require 'el-mock) -(load-file "../lisp/mastodon-toot.el") (ert-deftest mastodon-toot:cancel () (with-mock -- cgit v1.2.3