[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-clojure 803a419 193/313: Add test harness (finally?)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-clojure 803a419 193/313: Add test harness (finally?) |
Date: |
Wed, 11 Aug 2021 10:00:15 -0400 (EDT) |
branch: elpa/inf-clojure
commit 803a419de6cff6515fbb10644dd1e85df801883e
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Add test harness (finally?)
This patch add ert test harness and some tests around the
inf-clojure-completion-bounds-of-expr-at-point function.
---
.gitignore | 12 +++++
.travis.yml | 17 +++++++
Cask | 11 +++++
test/inf-clojure-tests.el | 114 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 154 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c724233
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*~
+*\#*\#
+*.\#*
+*.elc
+.cask
+elpa*
+.depend
+TAGS
+.DS_STORE
+dist
+.vagrant/
+.dir-locals?.el
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..57ec6dd
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: generic
+sudo: false
+before_install:
+ - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh
&& source ./x.sh
+ - evm install $EVM_EMACS --use --skip
+ - cask
+env:
+ - EVM_EMACS=emacs-24.3-travis
+ - EVM_EMACS=emacs-24.4-travis
+ - EVM_EMACS=emacs-24.5-travis
+ - EVM_EMACS=emacs-25.1-travis
+ - EVM_EMACS=emacs-25.2-travis
+ - EVM_EMACS=emacs-25.3-travis
+script:
+ - emacs --version
+ - cask install
+ - cask exec buttercup -L .
diff --git a/Cask b/Cask
new file mode 100644
index 0000000..d2a5667
--- /dev/null
+++ b/Cask
@@ -0,0 +1,11 @@
+(source gnu)
+(source melpa)
+
+(package-file "inf-clojure.el")
+
+(files "*.el" (:exclude ".dir-locals.el"))
+
+(development
+ (depends-on "clojure-mode")
+ (depends-on "buttercup")
+ (depends-on "assess"))
diff --git a/test/inf-clojure-tests.el b/test/inf-clojure-tests.el
new file mode 100644
index 0000000..994801c
--- /dev/null
+++ b/test/inf-clojure-tests.el
@@ -0,0 +1,114 @@
+;;; inf-clojure-tests.el --- Tests for Inf-Clojure -*- lexical-binding: t; -*-
+;;
+;; Copyright © 2014-2018 Bozhidar Batsov
+
+;; Authors: Bozhidar Batsov <bozhidar@batsov.com>
+;; Andrea Richiardi <a.richiardi.work@gmail.com>
+;; URL: http://github.com/clojure-emacs/inf-clojure
+;; Keywords: processes, clojure
+;; Package-Requires: ((emacs "24.4") (clojure-mode "5.3"))
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Code completion using alexander-yakushev/compliment.
+
+;;; Code:
+
+;; Tests for inf-clojure.el
+
+(message "Running tests on Emacs %s" emacs-version)
+
+(require 'buttercup)
+(require 'assess)
+(require 'inf-clojure)
+
+(cl-defmacro ict-with-assess-buffers ((&rest varlist) &body body)
+ `(assess-with-temp-buffers (,@varlist)
+ (clojure-mode)
+ (inf-clojure-minor-mode)
+ ,@body))
+
+(defun ict-bounds-string (bounds)
+ (buffer-substring (car bounds) (cdr bounds)))
+
+(describe "inf-clojure--kw-to-symbol"
+ (it "returns symbol form of the given keyword"
+ (expect (inf-clojure--kw-to-symbol "symbol") :to-equal "symbol")
+ (expect (inf-clojure--kw-to-symbol ":clj.core/str") :to-equal
"clj.core/str")
+ (expect (inf-clojure--kw-to-symbol "::keyword") :to-equal "keyword")
+ (expect (inf-clojure--kw-to-symbol nil) :to-equal nil)))
+
+(describe "completion bounds at point" ()
+ (it "computes bounds for plain-text"
+ (ict-with-assess-buffers
+ ((a (insert "plain-text")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal "plain-text"))))
+
+ (it "computes bounds for @deref"
+ (ict-with-assess-buffers
+ ((a (insert "@deref")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal "deref"))))
+
+ (it "computes bounds for ^:keyword"
+ (ict-with-assess-buffers
+ ((a (insert "^:keyword")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal ":keyword"))))
+
+ (it "computes bounds for ::keyword"
+ (ict-with-assess-buffers
+ ((a (insert "::keyword")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal "::keyword"))))
+
+ (it "computes bounds for [^:keyword (combined break chars and keyword)"
+ (ict-with-assess-buffers
+ ((a (insert "[^:keyword")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal ":keyword"))))
+
+ (it "computes no bounds for point directly after a break expression"
+ (ict-with-assess-buffers
+ ((a (insert "@")))
+ (with-current-buffer a
+ (expect
+ (ict-bounds-string (inf-clojure-completion-bounds-of-expr-at-point))
+ :not :to-be nil))))
+
+ (it "computes bounds for [symbol"
+ (ict-with-assess-buffers
+ ((a (insert "[symbol")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal "symbol"))))
+
+ (it "computes bounds for (@deref (multiple break chars)"
+ (ict-with-assess-buffers
+ ((a (insert "(@deref")))
+ (with-current-buffer a
+ (expect (ict-bounds-string
(inf-clojure-completion-bounds-of-expr-at-point))
+ :to-equal "deref")))))
+
+;;; inf-clojure-tests.el ends here
- [nongnu] elpa/inf-clojure 1c8429a 247/313: Bump the development version, (continued)
- [nongnu] elpa/inf-clojure 1c8429a 247/313: Bump the development version, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 5abac0b 262/313: Tweak the REPL type documentation, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 6f4e792 065/313: Add a note about mixing cider & inf-clojure, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure c797a5a 143/313: Release inf-clojure 2.0, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 0bb2700 156/313: Introduce inf-clojure-log-activity, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 86d0b60 158/313: Adopt find-ns for detecting the repl type, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b04f05d 174/313: Fix the default value for inf-clojure-arglists-form-planck (#112), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure ca96cfc 180/313: Add README note about ClojureScript REPL support, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 715bd82 188/313: Add macroexpand forms for Lumo, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure ec99211 189/313: Support loading directory locals in our buffers, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 803a419 193/313: Add test harness (finally?),
ELPA Syncer <=
- [nongnu] elpa/inf-clojure 903dd73 196/313: Set explicitly inf-clojure-repl-type for REPL and source buffer, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure de59fce 206/313: Merge pull request #142 from austinhaas/master, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 9deb198 202/313: Use comint-send-string, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b2224bc 211/313: Merge pull request #145 from austinhaas/master, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure cf53284 220/313: Fix for https://github.com/clojure-emacs/inf-clojure/issues/154 (#158), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 1e93db8 237/313: Bump the development version, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure c590c65 240/313: Remove projects from inf-clojure except to serve as project root, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 8fb1929 254/313: Set REPL type from startup form, prompt, or defcustom at startup, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure f298612 259/313: [Fix #173] Use clojure-mode project detection (#176), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 380528f 078/313: Bump the clojure-mode dependency, ELPA Syncer, 2021/08/11