From 8dce4f4d924d5f93c7d1b835f3a7edd3d95eef6a Mon Sep 17 00:00:00 2001 From: Yasuyuki Oka Date: Sun, 16 Oct 2016 20:53:44 +0900 Subject: [PATCH 1/3] Add test for "package install" To prevent package install error like #27 --- .gitignore | 1 + Cask | 1 + Makefile | 17 +++++++++++++++-- test/test-package-install.el | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/test-package-install.el diff --git a/.gitignore b/.gitignore index 9fb9c15..61314c7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .elc* elpa test/fixture/* +/test/test-package-install.log diff --git a/Cask b/Cask index 9c5ecac..956e36e 100644 --- a/Cask +++ b/Cask @@ -5,6 +5,7 @@ (depends-on "helm") (development + (depends-on "cask") (depends-on "f") (depends-on "ert") ; Unit test library (depends-on "ert-runner") ; Unit test runner diff --git a/Makefile b/Makefile index c3fd93e..fd96f38 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,14 @@ SRC ?= helm-git-grep.el FIXTURE_GIT_VERSION ?= v1.0.0 FIXTURE_GIT_WORK_DIR ?= test/fixture/git TEST_CHECKDOC_EL ?= test/test-checkdoc.el +TEST_PACKAGE_INSTALL_EL ?= test/test-package-install.el +TEST_PACKAGE_INSTALL_LOG ?= test/test-package-install.log LOADPATH = -L . ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory) - +TMP = .tmp .PHONY : test -test: test-checkdoc unit-tests +test: test-checkdoc test-package-install unit-tests .PHONY : unit-tests # `clean-elc` task needs to remove byte-compiled files to collect coverage by undercover.el. @@ -39,6 +41,17 @@ test-checkdoc: elpa @echo "-- test ckeckdoc --" @$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_CHECKDOC_EL) 2>&1 | [ $$(wc -l) -gt 0 ] && exit 1 || exit 0 +.PHONY : test-package-install +test-package-install: elpa clean-package-install + @echo "-- test install package --" + $(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_PACKAGE_INSTALL_EL) 2>&1 | tee $(TEST_PACKAGE_INSTALL_LOG) + @grep Error $(TEST_PACKAGE_INSTALL_LOG) && exit 1 || exit 0 + +.PHONY : clean-package-install +clean-package-install: + rm -rf $(ELPA_DIR)/helm-git-grep* + rm -rf $(TEST_PACKAGE_INSTALL_LOG) + .PHONY : travis-ci travis-ci: print-deps test diff --git a/test/test-package-install.el b/test/test-package-install.el new file mode 100644 index 0000000..7278d28 --- /dev/null +++ b/test/test-package-install.el @@ -0,0 +1,5 @@ +(require 'cask) +(cask-initialize ".") +(setq byte-compile-error-on-warn t) +(require 'package) +(package-install-file "helm-git-grep.el") From ae9d9e8b3484fd487b2b04433c7272fa77048ad9 Mon Sep 17 00:00:00 2001 From: Yasuyuki Oka Date: Sun, 16 Oct 2016 22:15:59 +0900 Subject: [PATCH 2/3] Display result of test-checkdoc --- .gitignore | 3 ++- Makefile | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 61314c7..fe7373d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .elc* elpa test/fixture/* -/test/test-package-install.log +test/test-package-install.log +test/test-checkdoc.log diff --git a/Makefile b/Makefile index fd96f38..dee47a7 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ SRC ?= helm-git-grep.el FIXTURE_GIT_VERSION ?= v1.0.0 FIXTURE_GIT_WORK_DIR ?= test/fixture/git TEST_CHECKDOC_EL ?= test/test-checkdoc.el +TEST_CHECKDOC_LOG ?= test/test-checkdoc.log TEST_PACKAGE_INSTALL_EL ?= test/test-package-install.el TEST_PACKAGE_INSTALL_LOG ?= test/test-package-install.log LOADPATH = -L . @@ -39,7 +40,8 @@ print-deps: .PHONY : test-checkdoc test-checkdoc: elpa @echo "-- test ckeckdoc --" - @$(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_CHECKDOC_EL) 2>&1 | [ $$(wc -l) -gt 0 ] && exit 1 || exit 0 + $(CASK) exec $(EMACS) -batch -Q $(LOADPATH) -l $(TEST_CHECKDOC_EL) 2>&1 | tee $(TEST_CHECKDOC_LOG) + @cat $(TEST_CHECKDOC_LOG) | [ $$(wc -l) -gt 0 ] && exit 1 || exit 0 .PHONY : test-package-install test-package-install: elpa clean-package-install From 811e6d37ff17363e096186d18330e743db8a7e04 Mon Sep 17 00:00:00 2001 From: Yasuyuki Oka Date: Sun, 16 Oct 2016 22:30:58 +0900 Subject: [PATCH 3/3] Exclude test-checkdoc from travis-ci --- .travis.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bcb2c11..8f715b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,4 +30,4 @@ install: script: # Run your tests - emacs --version - - make test + - make travis-ci diff --git a/Makefile b/Makefile index dee47a7..034ce4f 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ clean-package-install: rm -rf $(TEST_PACKAGE_INSTALL_LOG) .PHONY : travis-ci -travis-ci: print-deps test +travis-ci: print-deps test-package-install unit-tests .PHONY : elpa elpa: $(ELPA_DIR)