Skip to content

Commit

Permalink
gh-177 start unit testing the EDE implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew O. Smith committed Jun 29, 2015
1 parent 736dcda commit 0620ead
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 71 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ EMACS=emacs
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))

all: testr
all: test

testr:
test: test-elk test-ert

test-elk:
# cd $(mkfile_dir) && $(EMACS) -Q --batch -l src/test/lisp/init.el -l src/test/lisp/all-tests.el
cd $(mkfile_dir) && $(EMACS) -Q --batch -f toggle-debug-on-error -l src/test/lisp/init.el -l src/test/lisp/init-malabar.el -l src/test/lisp/all-tests.el

test-ert:
cd $(mkfile_dir) && $(EMACS) -Q --batch -l ert -l src/test/lisp/init.el -l src/test/lisp/init-malabar.el \
-l src/test/lisp/malabar-mode.ert \
-l src/test/lisp/malabar-ede-maven.ert \
-f ert-run-tests-batch-and-exit

1 change: 0 additions & 1 deletion src/main/lisp/malabar-ede-maven.el
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@
:name "MALABAR MAVEN2"
:file 'ede/maven2
:proj-file "pom.xml"
;:proj-root 'ede-maven2-project-root
;:load-type 'malabar-maven2-load
;:class-sym 'ede-malabar-maven2-project
;:new-p nil
Expand Down
45 changes: 45 additions & 0 deletions src/test/lisp/malabar-ede-maven.ert
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
;;; -*- emacs-lisp -*-
;; Copyright (c) 2009 Espen Wiborg <[email protected]>
;;
;; 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 2 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, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
;; 02110-1301 USA.
;;


(setq java-file "src/test/project/basic/src/main/java/com/software_ninja/App.java")


(defun malabar-ede-maven-project-dir ()
(if noninteractive
(getenv "PWD")
(expand-file-name "../../..")))



(ert-deftest malabar-ede-maven-doh ()
(should (= 1 1)))


(ert-deftest malabar-ede-maven-classpath ()
(with-temp-buffer
(require 'malabar-ede-maven)
(let ((file-name (expand-file-name java-file (malabar-ede-maven-project-dir))))
(insert-file-contents-literally file-name)
(setq buffer-file-name file-name)
(setq default-directory (file-name-directory file-name))
(java-mode)
(malabar-java-mode)
(should (equal "hasmter" (aref (ede-current-project) 2))))))

68 changes: 0 additions & 68 deletions src/test/lisp/malabar-mode.elk

This file was deleted.

48 changes: 48 additions & 0 deletions src/test/lisp/malabar-mode.ert
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
;;; -*- emacs-lisp -*-
;; Copyright (c) 2009 Espen Wiborg <[email protected]>
;;
;; 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 2 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, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
;; 02110-1301 USA.
;;


(setq java-file "src/test/project/basic/src/main/java/com/software_ninja/App.java")


(defun malabar-mode-project-dir ()
(if noninteractive
(getenv "PWD")
(expand-file-name "../../..")))



(ert-deftest malabar-mode-doh ()
(should (= 1 1)))


(ert-deftest malabar-mode-classpath ()
(with-temp-buffer
(let ((file-name (expand-file-name java-file (malabar-mode-project-dir))))
(insert-file-contents-literally file-name)
(setq buffer-file-name file-name)
(setq default-directory (file-name-directory file-name))
(java-mode)
(malabar-java-mode)
(should (equal "maven" malabar-mode-project-manager))
(should (equal "java" malabar-mode-project-parser))
(should (equal (expand-file-name "src/test/project/basic/" (malabar-mode-project-dir))
(expand-file-name malabar-mode-project-dir)))
(should (equal "basic" malabar-mode-project-name)))))

0 comments on commit 0620ead

Please sign in to comment.