[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6ee3f82 25/28: Refactor coverage.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 6ee3f82 25/28: Refactor coverage. |
Date: |
Tue, 05 May 2015 11:10:26 +0000 |
branch: master
commit 6ee3f8254b2543f47d40889ff650ec866e65145e
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Refactor coverage.
---
Makefile | 7 ++-
test/ci-coverage.el | 3 -
test/context-coloring-coverage.el | 84 +++++++++++++++++++++++++++++++++++++
test/local-coverage.el | 42 ------------------
4 files changed, 88 insertions(+), 48 deletions(-)
diff --git a/Makefile b/Makefile
index 868bd2a..bd82b88 100644
--- a/Makefile
+++ b/Makefile
@@ -30,17 +30,18 @@ test: ${DEPENDENCIES}
-L . \
-l ert \
-l ert-async \
- -l test/ci-coverage.el \
+ -l test/context-coloring-coverage.el \
+ -f context-coloring-coverage-ci-init \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
cover: ${DEPENDENCIES}
- COVERALLS_REPO_TOKEN="noop" \
${CASK} exec ${EMACS} -Q -batch \
-L . \
-l ert \
-l ert-async \
- -l test/local-coverage.el \
+ -l test/context-coloring-coverage.el \
+ -f context-coloring-coverage-local-init \
-l test/context-coloring-test.el \
-f ert-run-tests-batch-and-exit
diff --git a/test/ci-coverage.el b/test/ci-coverage.el
deleted file mode 100644
index 1c97075..0000000
--- a/test/ci-coverage.el
+++ /dev/null
@@ -1,3 +0,0 @@
-(require 'undercover)
-(undercover "context-coloring.el")
-(require 'context-coloring)
diff --git a/test/context-coloring-coverage.el
b/test/context-coloring-coverage.el
new file mode 100644
index 0000000..0383ac4
--- /dev/null
+++ b/test/context-coloring-coverage.el
@@ -0,0 +1,84 @@
+;;; context-coloring-coverage.el --- Test coverage for context coloring -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Test coverage support for context coloring.
+
+;; Use with `make cover'.
+
+;;; Code:
+
+(require 'undercover)
+
+
+(defconst context-coloring-coverage-directory
+ (file-name-directory (or load-file-name buffer-file-name))
+ "This file's directory.")
+
+(defun context-coloring-coverage-resolve-path (path)
+ "Resolve PATH from this file's directory."
+ (expand-file-name path context-coloring-coverage-directory))
+
+(defconst context-coloring-coverage-output-file-prefix
+ (format-time-string "%s"))
+
+(defconst context-coloring-coverage-output-directory
+ (context-coloring-coverage-resolve-path "./coverage/"))
+
+(defconst context-coloring-coverage-output-file
+ (concat context-coloring-coverage-output-directory
+ context-coloring-coverage-output-file-prefix ".json"))
+
+(defconst context-coloring-coverage-report-file
+ (concat context-coloring-coverage-output-directory
+ context-coloring-coverage-output-file-prefix ".txt"))
+
+(defconst context-coloring-coverage-parser
+ (concat "node " (context-coloring-coverage-resolve-path
"./parse-coverage.js")))
+
+(defun context-coloring-coverage-local-init ()
+ "Initialize test coverage for local viewing."
+ (make-directory context-coloring-coverage-output-directory t)
+ (setq undercover-force-coverage t)
+ (setenv "COVERALLS_REPO_TOKEN" "noop")
+ (undercover "context-coloring.el"
+ (:report-file context-coloring-coverage-output-file))
+ (add-hook
+ 'kill-emacs-hook
+ (lambda ()
+ (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
+ (call-process-shell-command
+ context-coloring-coverage-parser
+ context-coloring-coverage-output-file
+ output-buffer)
+ (with-current-buffer output-buffer
+ (princ (buffer-substring-no-properties (point-min) (point-max)))
+ (write-file context-coloring-coverage-report-file))))
+ t)
+ (require 'context-coloring))
+
+(defun context-coloring-coverage-ci-init ()
+ "Initialize test coverage for continuous integration."
+ (undercover "context-coloring.el")
+ (require 'context-coloring))
+
+(provide 'context-coloring-coverage)
+
+;; context-coloring-coverage.el ends here
diff --git a/test/local-coverage.el b/test/local-coverage.el
deleted file mode 100644
index 7d6ee0d..0000000
--- a/test/local-coverage.el
+++ /dev/null
@@ -1,42 +0,0 @@
-(defconst context-coloring-test-directory
- (file-name-directory (or load-file-name buffer-file-name))
- "This file's directory.")
-
-(defun context-coloring-test-resolve-path (path)
- "Resolve PATH from this file's directory."
- (expand-file-name path context-coloring-test-directory))
-
-(defconst context-coloring-coverage-output-file-prefix
- (format-time-string "%s"))
-
-(defconst context-coloring-coverage-output-file
- (context-coloring-test-resolve-path
- (concat "./coverage/" context-coloring-coverage-output-file-prefix
".json")))
-
-(defconst context-coloring-coverage-report-file
- (context-coloring-test-resolve-path
- (concat "./coverage/" context-coloring-coverage-output-file-prefix ".txt")))
-
-(defconst context-coloring-test-coverage-parser
- (concat "node " (context-coloring-test-resolve-path "./parse-coverage.js")))
-
-(require 'undercover)
-(setq undercover-force-coverage t)
-(make-directory (context-coloring-test-resolve-path "./coverage/") t)
-(undercover "context-coloring.el"
- (:report-file context-coloring-coverage-output-file))
-
-(add-hook
- 'kill-emacs-hook
- (lambda ()
- (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
- (call-process-shell-command
- context-coloring-test-coverage-parser
- context-coloring-coverage-output-file
- output-buffer)
- (with-current-buffer output-buffer
- (princ (buffer-substring-no-properties (point-min) (point-max)))
- (write-file context-coloring-coverage-report-file))))
- t)
-
-(require 'context-coloring)
- [elpa] master 158fd83 16/28: Test the trimming function., (continued)
- [elpa] master 158fd83 16/28: Test the trimming function., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 0c20edf 14/28: Add coverage for missing lines., Jackson Ray Hamilton, 2015/05/05
- [elpa] master d116055 12/28: Fix original-maximum-face restoration bug., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 1b6f6fb 21/28: Cleanup README., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 5dd3035 19/28: Refactor trim functions., Jackson Ray Hamilton, 2015/05/05
- [elpa] master f8cfd37 22/28: Double-space., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 64852e7 24/28: Update library headers., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 55ca15a 23/28: Guard against excessively lenghty nodes., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8f1af4a 20/28: Update library header., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dbddc45 26/28: Reimplement coverage reporter in elisp., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 6ee3f82 25/28: Refactor coverage.,
Jackson Ray Hamilton <=
- [elpa] master 283a006 27/28: Version 6.2.1., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8a083d5 28/28: Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from context-coloring, Jackson Ray Hamilton, 2015/05/05