Skip to content

Commit

Permalink
Reorganize build and tests with cask-package-toolset
Browse files Browse the repository at this point in the history
  • Loading branch information
Bar Magal committed Aug 15, 2015
1 parent 40c4a5f commit ad25ade
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .ert-runner
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-L .
-L .
15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# temporary files
# Compiled and temporary files
*.elc
*~
# Cask's hidden directory
.cask
# compiled files
*.elc

# Cask
/.cask
dist

# Ecukes
/features/project/.cask
/features/project/test/*.el
41 changes: 23 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
language: emacs-lisp
before_install:
# prepare paths for EVM and Cask
- sudo mkdir /usr/local/evm
- sudo chown $USER:$USER /usr/local/evm
- export PATH="$HOME/.cask/bin:$PATH"
- export PATH="$HOME/.evm/bin:$PATH"
# install EVM, Emacs and Cask (Emacs before Cask, because Cask needs Emacs)
- curl -fssl https://raw.githubusercontent.com/rejeep/evm/master/go | bash
- evm install $EVM_EMACS --use --skip
- curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python
# initiate cask
- cask
env:
# - EVM_EMACS=emacs-24.1-bin
# - EVM_EMACS=emacs-24.2-bin
- EVM_EMACS=emacs-24.3-bin
- EVM_EMACS=emacs-24.4-bin
- EVM_EMACS=emacs-24.5-bin

script:
- emacs --version
- make test

env:
matrix:
- EVM_EMACS=emacs-24.5-bin
- EVM_EMACS=emacs-24.4-bin
- EVM_EMACS=emacs-24.3-bin
# - EVM_EMACS=emacs-24.2-bin
# - EVM_EMACS=emacs-24.1-bin
- EVM_EMACS=emacs-git-snapshot
matrix:
fast_finish: true
allow_failures:
- env: EVM_EMACS=emacs-git-snapshot

sudo: required
before_install:
- curl -fsSkL https://gist.github.com/rejeep/7736123/raw > travis.sh && source ./travis.sh
- evm install $EVM_EMACS --use --skip
- cask

# notifications:
# email: false
13 changes: 8 additions & 5 deletions Cask
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
(source melpa)

(development
(depends-on "cask-package-toolset")
(depends-on "ert-runner")
(depends-on "undercover")
(depends-on "cl-lib")
(depends-on "let-alist")
(depends-on "imenu-list")
(depends-on "hydra") ;; for lv.el
(depends-on "helm")
(depends-on "neotree")
(depends-on "popwin")
(depends-on "guide-key"))
;; (depends-on "hydra") ;; for lv.el
;; (depends-on "helm")
;; (depends-on "neotree")
;; (depends-on "popwin")
;; (depends-on "guide-key")
;; (depends-on "which-key")
)
28 changes: 8 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
EMACS ?= emacs
CASK ?= cask
SOURCES = window-purpose-utils.el window-purpose-configuration.el window-purpose-core.el window-purpose-prefix-overload.el window-purpose-switch.el window-purpose-layout.el window-purpose-fixes.el window-purpose.el window-purpose-x.el
EMACS ?= emacs
INPUT_FILE := "test/user-input.txt"

all: test

deps:
${CASK} install

test: clean deps test-fast
# ecukes not used, so test only init
test: unit

test-fast:
rm -f ${INPUT_FILE}
touch ${INPUT_FILE}
unit:
${CASK} exec ert-runner < ${INPUT_FILE}

compile: clean-elc deps
${CASK} exec ${EMACS} -Q --batch -L . -f batch-byte-compile ${SOURCES}
ecukes:
${CASK} exec ecukes

clean: clean-elc clean-deps

clean-elc:
rm -f *.elc

clean-deps:
rm -rf .cask/

.PHONY: all test clean
install:
${CASK} install
72 changes: 53 additions & 19 deletions test/test-helper.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; test-helper.el --- Test helpers -*- lexical-binding: t -*-
;;; test-helper --- Test helper for window-purpose -*- lexical-binding: t -*-

;; Copyright (C) 2015 Bar Magal

Expand All @@ -21,24 +21,57 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;; This file contains test helpers.
;; This file contains test helpers for window-purpose.
;; The sandbox part is 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 window-purpose-test-path
(f-dirname (f-this-file)))

(defvar window-purpose-root-path
(f-parent window-purpose-test-path))

(defvar window-purpose-sandbox-path
(f-expand "sandbox" window-purpose-test-path))

(when (f-exists? window-purpose-sandbox-path)
(error "Something is already in %s. Check and destroy it yourself" window-purpose-sandbox-path))

(defmacro within-sandbox (&rest body)
"Evaluate BODY in an empty sandbox directory."
`(let ((default-directory window-purpose-sandbox-path))
(when (f-exists? window-purpose-sandbox-path)
(f-delete default-directory :force))
(f-mkdir window-purpose-sandbox-path)
,@body
(f-delete default-directory :force)))

(require 'ert)

(set-frame-width nil 80)
(set-frame-height nil 24)

(message "setting undercover")
(require 'undercover)
(undercover "window-purpose.el"
"window-purpose-configuration.el"
"window-purpose-core.el"
"window-purpose-layout.el"
"window-purpose-prefix-overload.el"
"window-purpose-switch.el"
"window-purpose-utils.el"
"window-purpose-fixes.el"
"window-purpose-x.el")
(condition-case err
(progn
(message "setting undercover")
(require 'undercover)
(undercover "window-purpose.el"
"window-purpose-configuration.el"
"window-purpose-core.el"
"window-purpose-layout.el"
"window-purpose-prefix-overload.el"
"window-purpose-switch.el"
"window-purpose-utils.el"
"window-purpose-fixes.el"
"window-purpose-x.el"))
(error
(message "Error setting undercover: %S" err)))

(message "loading purpose")

Expand All @@ -47,11 +80,12 @@

(message "loading other packages")

(require 'lv)
(require 'helm)
(require 'neotree)
(require 'popwin)
(require 'guide-key)
;; (require 'lv)
;; (require 'helm)
;; (require 'neotree)
;; (require 'popwin)
;; (require 'guide-key)
;; (require 'which-key)

(message "defining helper functions and variables")

Expand Down Expand Up @@ -184,5 +218,5 @@ This is a destructive function; it reuses SYMBOLS' storage if possible."
(cl-sort symbols #'string< :key #'symbol-name))

(message "done defining helpers")

(provide 'test-helper)
;;; test-helper.el ends here

0 comments on commit ad25ade

Please sign in to comment.