This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test framework and the first test for parsing the request error
- Loading branch information
Showing
6 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
*.elc | ||
.ert-runner | ||
.cask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
language: generic | ||
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 | ||
env: | ||
- EVM_EMACS=emacs-24.1-travis | ||
- EVM_EMACS=emacs-24.2-travis | ||
- EVM_EMACS=emacs-24.3-travis | ||
- EVM_EMACS=emacs-24.4-travis | ||
- EVM_EMACS=emacs-24.5-travis | ||
script: | ||
- emacs --version | ||
- make test | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(source gnu) | ||
(source melpa) | ||
|
||
(files "*.el") | ||
|
||
(development | ||
(depends-on "f") | ||
(depends-on "ecukes") | ||
(depends-on "ert-runner") | ||
(depends-on "el-mock") | ||
(depends-on "request") | ||
(depends-on "cask-package-toolset")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CASK ?= cask | ||
EMACS ?= emacs | ||
|
||
all: test | ||
|
||
test: unit #ecukes | ||
|
||
unit: | ||
${CASK} exec ert-runner | ||
|
||
ecukes: | ||
${CASK} exec ecukes | ||
|
||
install: | ||
${CASK} install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
;;; Test for `matrix-client' | ||
|
||
;;; Commentary: | ||
;; These are the tests for `matrix-client' | ||
|
||
;;; Code: | ||
|
||
(require 'matrix-helpers) | ||
|
||
(ert-deftest matrix-parse-curl () | ||
(should | ||
(eq 51 | ||
(matrix-parse-curl-exit-code "exited abnormally with code 51"))) | ||
(should | ||
(eq 60 | ||
(matrix-parse-curl-exit-code "exited abnormally with code 60"))) | ||
(should | ||
(eq nil | ||
(matrix-parse-curl-exit-code "bagels and beans")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
;;; test-helper --- Test helper for matrix-client | ||
|
||
;;; Commentary: | ||
;; test helper inspired from https://github.com/tonini/overseer.el/blob/master/test/test-helper.el | ||
|
||
;;; Code: | ||
|
||
(require 'f) | ||
|
||
(defvar cpt-path | ||
(f-parent (f-this-file))) | ||
|
||
(defvar matrix-client-test-path | ||
(f-dirname (f-this-file))) | ||
|
||
(defvar matrix-client-root-path | ||
(f-parent matrix-client-test-path)) | ||
|
||
(defvar matrix-client-sandbox-path | ||
(f-expand "sandbox" matrix-client-test-path)) | ||
|
||
(when (f-exists? matrix-client-sandbox-path) | ||
(error "Something is already in %s. Check and destroy it yourself" matrix-client-sandbox-path)) | ||
|
||
(defmacro within-sandbox (&rest body) | ||
"Evaluate BODY in an empty sandbox directory." | ||
`(let ((default-directory matrix-client-sandbox-path)) | ||
(when (f-exists? matrix-client-sandbox-path) | ||
(f-delete default-directory :force)) | ||
(f-mkdir matrix-client-sandbox-path) | ||
,@body | ||
(f-delete default-directory :force))) | ||
|
||
(require 'ert) | ||
(require 'el-mock) | ||
(eval-when-compile | ||
(require 'cl)) | ||
(require 'matrix-client) | ||
|
||
(provide 'test-helper) | ||
;;; test-helper.el ends here |