Permalink
Browse files

Merge pull request #3 from tonini/introduce-testing

Introduce testing
  • Loading branch information...
tonini committed Oct 24, 2013
2 parents a08e55a + c03d4d8 commit be631a30b21ad3810b5818608d2f3d0e7623e070
Showing with 102 additions and 0 deletions.
  1. +14 −0 .travis.yml
  2. +12 −0 Makefile
  3. +2 −0 README.md
  4. +6 −0 elixir-mix.el
  5. +50 −0 test/elixir-mix-tests.el
  6. +18 −0 test/test-runner.el
View
@@ -0,0 +1,14 @@
+language: emacs-lisp
+
+env:
+ - EMACS=emacs24
+ - EMACS=emacs-snapshot
+
+before_script:
+ - export DEBIAN_FRONTEND='noninteractive'
+ - sudo apt-add-repository -y ppa:cassou/emacs
+ - sudo apt-get update -qq
+ - sudo apt-get install -yy emacs24 emacs24-el emacs24-common-non-dfsg emacs-snapshot emacs-snapshot-el
+
+script:
+ - make EMACS=${EMACS} test
View
@@ -0,0 +1,12 @@
+EMACS=emacs
+
+.PHONY: show-version test
+
+show-version:
+ @ echo "### Emacs Information ###"
+ @ echo "PATH = `which ${EMACS}`"
+ ${EMACS} --version
+
+test: show-version
+ @ echo "### elixir-mix test suite ###"
+ ${EMACS} -batch -Q -l test/test-runner.el
View
@@ -1,5 +1,7 @@
# elixir-mix.el
+[![Build Status](https://travis-ci.org/tonini/elixir-mix.el.png?branch=introduce-testing)](https://travis-ci.org/tonini/elixir-mix.el)
+
Integration of Elixir's building and deployment tool: mix into Emacs.
## Installation
View
@@ -159,6 +159,12 @@
(defun elixir-mix--completing-read (prompt command-list)
(completing-read prompt command-list nil t nil nil (car command-list)))
+(defun elixir-mix-flatten (alist)
+ (cond ((null alist) nil)
+ ((atom alist) (list alist))
+ (t (append (elixir-mix-flatten (car alist))
+ (elixir-mix-flatten (cdr alist))))))
+
(defun elixir-mix-new (name)
"Create a new elixir project with mix."
(interactive "Gmix new: ")
View
@@ -0,0 +1,50 @@
+;;; elixir-mix-tests.el --- elixir-mix ert unit tests
+
+;; Copyright © 2013 Samuel Tonini
+
+;; Author: Samuel Tonini
+;; Maintainer: Samuel Tonini
+;; Description: Integration of Elixir's building and deployment tool: mix into Emacs.
+;; Created: So Jun 9 10:01:02 2013 (+0200)
+;; URL: https://github.com/tonini/elixir-mix
+
+;; This file is NOT part of GNU Emacs.
+
+;; The MIT License (MIT)
+;;
+;; Copyright (c) Samuel Tonini
+;;
+;; Permission is hereby granted, free of charge, to any person obtaining a copy of
+;; this software and associated documentation files (the "Software"), to deal in
+;; the Software without restriction, including without limitation the rights to
+;; use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+;; the Software, and to permit persons to whom the Software is furnished to do so,
+;; subject to the following conditions:
+;;
+;; The above copyright notice and this permission notice shall be included in all
+;; copies or substantial portions of the Software.
+;;
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+;; FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+;; COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+;; IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+;;; Commentary:
+
+;;; Code:
+
+(provide 'elixir-mix-tests)
+
+(require 'ert)
+(require 'elixir-mix)
+
+(ert-deftest test-flatten-of-list ()
+ (should (equal (elixir-mix-flatten '(1 2 (3 4) 5))
+ '(1 2 3 4 5)))
+ (should (equal (elixir-mix-flatten '(1 2 ("wood" "fire" (3)) 4 5))
+ '(1 2 "wood" "fire" 3 4 5))))
+
+
+;;; elixir-mix-tests.el ends here
View
@@ -0,0 +1,18 @@
+;; Usage:
+;;
+;; emacs -Q -l test/test-runner.el # interactive mode
+;; emacs -batch -Q -l test/test-runner.el # batch mode
+
+(let ((current-directory (file-name-directory load-file-name)))
+ (setq elixir-mix-test-path (expand-file-name "." current-directory))
+ (setq elixir-mix-root-path (expand-file-name ".." current-directory)))
+
+(add-to-list 'load-path elixir-mix-root-path)
+(add-to-list 'load-path elixir-mix-test-path)
+
+(require 'elixir-mix)
+
+(dolist (test-file (or argv (directory-files elixir-mix-test-path t "-tests.el$")))
+ (load test-file nil t))
+
+(ert-run-tests-batch-and-exit t)

0 comments on commit be631a3

Please sign in to comment.