Skip to content

Add code coverage #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ INSTALL_INFO = install-info
# This is particularly useful when EMACS is set in ~/.bash_profile
#
EMACS := $(shell which "$${EMACS}" || which "emacs")
EMACS_VERSION := $(shell "$(EMACS)" -Q --batch --eval '(princ emacs-version)')

EFLAGS = --eval "(add-to-list 'load-path (expand-file-name \"tests/compat\") 'append)" \
--eval "(when (< emacs-major-version 24) \
(setq byte-compile-warnings '(not cl-functions)))" \
--eval '(setq byte-compile-error-on-warn t)' \
--eval '(when (not (version< emacs-version "24.4")) (setq load-prefer-newer t))'
--eval '(when (not (version< emacs-version "24.4")) (setq load-prefer-newer t))' \
--eval '(defun byte-compile-dest-file (filename) \
(concat (file-name-directory filename) "build-" emacs-version "/" \
(file-name-nondirectory filename) "c"))'

BATCH = $(EMACS) $(EFLAGS) --batch -Q -L .

Expand Down Expand Up @@ -75,17 +79,13 @@ ELFILES = \
haskell-utils.el \
inf-haskell.el

ELCFILES = $(ELFILES:.el=.elc)
ELCHECKS := $(shell echo tests/*-tests.el)

AUTOLOADS = haskell-mode-autoloads.el

PKG_DIST_FILES = $(ELFILES) logo.svg NEWS haskell-mode.info dir
ELCHECKS=$(addprefix check-, $(ELFILES:.el=))

%.elc: %.el
@$(BATCH) \
-f batch-byte-compile $*.el

.PHONY: all compile info clean check $(ELCHECKS) elpa package check-emacs-version
.PHONY: all compile info clean check check-emacs-version

all: check-emacs-version compile $(AUTOLOADS) info

Expand All @@ -100,20 +100,30 @@ check-emacs-version :
(message \" 3. make EMACS=/path/to/emacs\") \
(kill-emacs 2))"

compile: $(ELCFILES)

$(ELCHECKS): check-%: %.el %.elc
@$(BATCH) --eval '(when (check-declare-file "$*.el") (error "check-declare failed"))'
@if [ -f "$(<:%.el=tests/%-tests.el)" ]; then \
$(BATCH) -l "$(<:%.el=tests/%-tests.el)" -f ert-run-tests-batch-and-exit; \
compile: build-$(EMACS_VERSION)

build-$(EMACS_VERSION) : $(ELFILES)
if [ ! -d $@ ]; then mkdir $@; fi
$(BATCH) -f batch-byte-compile-if-not-done $^

check-%: tests/%-tests.el
$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;

check: $(ELCHECKS) build-$(EMACS_VERSION)
$(BATCH) --eval "(when (>= emacs-major-version 24) \
(require 'undercover) \
(undercover \"*.el\" (:exclude \"haskell-mode-pkg.el\")))" \
$(patsubst %,-l %,$(ELCHECKS)) \
-f ert-run-tests-batch-and-exit
@TAB=$$(echo "\t"); \
if grep -Hn "[ $${TAB}]\+\$$" *.el; then \
echo "Some files contain whitespace at the end of lines, correct it"; \
exit 3; \
fi
@echo "--"

check: $(ELCHECKS)
@echo "checks passed!"

clean:
$(RM) $(ELCFILES) $(AUTOLOADS) $(AUTOLOADS:.el=.elc) haskell-mode.info dir
$(RM) -r build-$(EMACS_VERSION) $(AUTOLOADS) $(AUTOLOADS:.el=.elc) haskell-mode.info dir

info: haskell-mode.info dir

Expand Down Expand Up @@ -158,7 +168,7 @@ doc/html : doc/html/index.html \
deploy-manual : doc/html
cd doc && ./deploy-manual.sh

$(AUTOLOADS): $(ELFILES) haskell-mode.elc
$(AUTOLOADS): $(ELFILES)
$(BATCH) \
--eval '(setq make-backup-files nil)' \
--eval '(setq generated-autoload-file "$(CURDIR)/$@")' \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

This is an Emacs mode for editing, debugging and developing Haskell programs.

[![Coverage Status](https://coveralls.io/repos/haskell/haskell-mode/badge.svg?branch=master&service=github)](https://coveralls.io/github/haskell/haskell-mode?branch=master)
[![Build Status](https://travis-ci.org/haskell/haskell-mode.svg?branch=master)](https://travis-ci.org/haskell/haskell-mode)
[![Melpa Status](http://melpa.org/packages/haskell-mode-badge.svg)](http://melpa.org/#/haskell-mode)
[![Melpa Stable Status](http://stable.melpa.org/packages/haskell-mode-badge.svg)](http://stable.melpa.org/#/haskell-mode)
Expand Down
Loading