Subject: Tests for emacs-clojure-mode

From: Arun Isaac <[email-masked]>
Date: Fri, 12 May 2017 00:01:05 +0530

Please find attached a patch set for adding ert-runner, emacs-ansi,
emacs-commander, and enabling tests for emacs-clojure-mode.

>From 52c39f301978ec7081f43466aec5211185eb43dd Mon Sep 17 00:00:00 2001
From: Arun Isaac <[email-masked]>
Date: Thu, 11 May 2017 23:23:30 +0530
Subject: [PATCH 1/4] gnu: Add emacs-ansi.

* gnu/packages/emacs.scm (emacs-ansi): New variable.
---
 gnu/packages/emacs.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 41fc240e1..a95cf519b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4646,3 +4646,30 @@ addition of surrounding pairs, such as parantheses and quotes, in evil mode.")
 comment out lines of code in evil mode.  It provides @code{gcc} to comment out
 lines, and @code{gc} to comment out the target of a motion.")
     (license license:gpl3+)))
+
+;; Tests for emacs-ansi have a circular dependency with ert-runner, and
+;; therefore cannot be run
+(define-public emacs-ansi
+  (package
+    (name "emacs-ansi")
+    (version "0.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/rejeep/ansi.el/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "13jj4vbi98j3p17hs99bmy7g21jd5h4v3wpxk4pkvhylm3bfwjw8"))))
+    (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-dash" ,emacs-dash)
+       ("emacs-s" ,emacs-s)))
+    (home-page "https://github.com/rejeep/ansi.el")
+    (synopsis "Convert strings to ANSI")
+    (description "@code{emacs-ansi} defines functions that turns simple
+strings to ANSI strings.  Turning a string into an ANSI string can be to add
+color to a text, add color in the background of a text or adding a style, such
+as bold, underscore or italic.")
+    (license license:gpl3+)))
-- 
2.12.2

>From 75b5e7ae59be84680077dca4942eecca275f7c8c Mon Sep 17 00:00:00 2001
From: Arun Isaac <[email-masked]>
Date: Thu, 11 May 2017 23:24:43 +0530
Subject: [PATCH 2/4] gnu: Add emacs-commander.

* gnu/packages/emacs.scm (emacs-commander): New variable.
---
 gnu/packages/emacs.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a95cf519b..e2dbb12c4 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4673,3 +4673,29 @@ strings to ANSI strings.  Turning a string into an ANSI string can be to add
 color to a text, add color in the background of a text or adding a style, such
 as bold, underscore or italic.")
     (license license:gpl3+)))
+
+;; Tests for emacs-commander have a circular dependency with ert-runner, and
+;; therefore cannot be run
+(define-public emacs-commander
+  (package
+    (name "emacs-commander")
+    (version "0.7.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/rejeep/commander.el/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "196s2i15z7gwxa97l1wkxvjnfmj5n38wwm6d3g4zz15l2vqggc2y"))))
+    (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-dash" ,emacs-dash)
+       ("emacs-f" ,emacs-f)
+       ("emacs-s" ,emacs-s)))
+    (home-page "https://github.com/rejeep/commander.el")
+    (synopsis "Emacs command line parser")
+    (description "@code{emacs-commander} provides command line parsing for
+Emacs.")
+    (license license:gpl3+)))
-- 
2.12.2

>From 77491a17bbbaef34d94bd37732a031988796aa66 Mon Sep 17 00:00:00 2001
From: Arun Isaac <[email-masked]>
Date: Thu, 11 May 2017 23:25:27 +0530
Subject: [PATCH 3/4] gnu: Add ert-runner.

* gnu/packages/emacs.scm (ert-runner): New variable.
---
 gnu/packages/emacs.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e2dbb12c4..e2d2e0786 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4699,3 +4699,57 @@ as bold, underscore or italic.")
     (description "@code{emacs-commander} provides command line parsing for
 Emacs.")
     (license license:gpl3+)))
+
+;; Tests for ert-runner have a circular dependency with ecukes, and therefore
+;; cannot be run
+(define-public ert-runner
+  (let ((dependencies
+         `(("emacs-ansi" ,emacs-ansi)
+           ("emacs-commander" ,emacs-commander)
+           ("emacs-dash" ,emacs-dash)
+           ("emacs-f" ,emacs-f)
+           ("emacs-s" ,emacs-s)
+           ("emacs-shut-up" ,emacs-shut-up))))
+    (package
+      (name "ert-runner")
+      (version "0.7.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/rejeep/ert-runner.el/archive/v"
+                             version ".tar.gz"))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (sha256
+          (base32
+           "1657nck9i96a4xgl8crfqq0s8gflzp21pkkzwg6m3z5npjxklgwp"))))
+      (build-system emacs-build-system)
+      (inputs dependencies)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'install 'install-executable
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (substitute* "bin/ert-runner"
+                   (("ERT_RUNNER=\"\\$\\(dirname \\$\\(dirname \\$0\\)\\)")
+                    (string-append "ERT_RUNNER=\"" out
+                                   "/share/emacs/site-lisp/guix.d/"
+                                   ,name "-" ,version)))
+                 (install-file "bin/ert-runner" (string-append out "/bin"))
+                 (wrap-program (string-append out "/bin/ert-runner")
+                   (list "EMACSLOADPATH" ":" '=
+                         (append
+                          (map (lambda (name version)
+                                 (string-append
+                                  (assoc-ref inputs name)
+                                  "/share/emacs/site-lisp/guix.d/"
+                                  (substring name 6) "-" version))
+                               ',(map car dependencies)
+                               ',(map (compose package-version cadr) dependencies))
+                          (list ""))))))))))
+      (home-page "https://github.com/rejeep/ert-runner.el")
+      (synopsis "Opinionated Ert testing workflow")
+      (description "@code{ert-runner} is a tool for Emacs projects tested
+using ERT.  It assumes a certain test structure setup and can therefore make
+running tests easier.")
+      (license license:gpl3+))))
-- 
2.12.2

>From 8b9bfa1f646d7211514395400adb1abaf4c2369c Mon Sep 17 00:00:00 2001
From: Arun Isaac <[email-masked]>
Date: Thu, 11 May 2017 23:28:53 +0530
Subject: [PATCH 4/4] gnu: emacs-clojure-mode: Enable tests.

* gnu/packages/emacs.scm (emacs-clojure-mode)[arguments]: Add 'check' phase.
[native-inputs]: Add emacs-dash, emacs-s and ert-runner.
---
 gnu/packages/emacs.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e2d2e0786..e45368cdd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2882,6 +2882,16 @@ S-expression.")
                (base32
                 "117mvjqh4nm8mvmwmmvy4qmkdg23ldlzk08y91g8b8ac8kxwqg81"))))
     (build-system emacs-build-system)
+    (native-inputs
+     `(("emacs-dash" ,emacs-dash)
+       ("emacs-s" ,emacs-s)
+       ("ert-runner" ,ert-runner)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'check
+           (lambda* (#:key inputs #:allow-other-keys)
+             (zero? (system* "ert-runner")))))))
     (home-page "https://github.com/clojure-emacs/clojure-mode")
     (synopsis "Major mode for Clojure code")
     (description
-- 
2.12.2