diff --git a/Makefile b/Makefile index ca47562..1c5b4b7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ EMACS ?= emacs +CASK ?= cask ELS = phpactor.el company-phpactor.el AUTOLOADS = phpactor-autoloads.el ELCS = $(ELS:.el=.elc) @@ -6,7 +7,7 @@ ELCS = $(ELS:.el=.elc) %.elc: %.el $(EMACS) -Q -batch -L . -f package-initialize -f batch-byte-compile $< -all: clean autoloads $(ELCS) +all: .cask $(ELCS) autoloads autoloads: $(AUTOLOADS) @@ -17,6 +18,17 @@ $(AUTOLOADS): $(ELCS) (normal-top-level-add-subdirs-to-load-path) \ (package-generate-autoloads \"phpactor\" default-directory))" +.cask: Cask + $(CASK) install + +test: .cask $(ELCS) + $(EMACS) -Q -batch -L . --eval \ + "(let ((default-directory (expand-file-name \".cask\" default-directory))) \ + (normal-top-level-add-subdirs-to-load-path) \ + (require 'buttercup))" \ + --eval "(setq warning-minimum-log-level :debug)" \ + -f buttercup-run-discover + clean: rm -f $(ELCS) $(AUTOLOADS) diff --git a/tests/e2e/test-sanity.el b/tests/e2e/test-sanity.el index 9c8f34f..1ba8bdf 100644 --- a/tests/e2e/test-sanity.el +++ b/tests/e2e/test-sanity.el @@ -1,3 +1,30 @@ +;;; test-sanity.el --- Behavior-Driven test for phpactor -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Friends of Emacs-PHP development + +;; Author: Mikael Kermorgant +;; Keywords: maint + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; A BDD test code based on Buttercup. +;; https://github.com/jorgenschaefer/emacs-buttercup + +;;; Code: +(require 'buttercup) (require 'phpactor) (defun buffer-string* (buffer) @@ -11,13 +38,13 @@ (describe "var: `phpactor-install-directory'" (it "should have some value" - (display-warning 'buttercup (format "phpactor install folder is : %s" phpactor-install-directory)) + (display-warning 'buttercup (format "phpactor install folder is : %s" phpactor-install-directory) :debug) (expect phpactor-install-directory :not :to-be nil) )) (describe ": `phpactor--lisp-directory'" ;; I prefer having a test as I'm not that really fine with it being nil (it "should have some value" - (display-warning 'buttercup (format "phpactor lisp folder is : %s" phpactor--lisp-directory)) + (display-warning 'buttercup (format "phpactor lisp folder is : %s" phpactor--lisp-directory) :debug) (expect phpactor--lisp-directory :not :to-be nil) )) @@ -42,3 +69,6 @@ (expect 'php-project-get-root-dir :to-have-been-called) ) )) + +(provide 'test-sanity) +;;; test-sanity.el ends here