[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-nerd-commenter aa34d89797 185/235: add unit test and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-nerd-commenter aa34d89797 185/235: add unit test and CI |
Date: |
Thu, 6 Jan 2022 02:59:46 -0500 (EST) |
branch: elpa/evil-nerd-commenter
commit aa34d89797692722d5e7d2db0dd07b5c1bd25a7d
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
add unit test and CI
---
.travis.yml | 30 +++++++++++++++
Makefile | 17 +++++++++
evil-nerd-commenter-operator.el | 2 -
evil-nerd-commenter-sdk.el | 4 +-
evil-nerd-commenter-tests.el | 81 +++++++++++++++++++++++++++++++++++++++++
evil-nerd-commenter.el | 3 +-
6 files changed, 130 insertions(+), 7 deletions(-)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..09ff39cc7c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,30 @@
+language: generic
+
+env:
+ global:
+ - CURL="curl -fsSkL --retry 9 --retry-delay 9"
+ matrix:
+ - EMACS_VERSION=24.4
+ - EMACS_VERSION=24.5
+ - EMACS_VERSION=25.3
+ - EMACS_VERSION=26.1
+ - EMACS_VERSION=master
+
+matrix:
+ allow_failures:
+ - env: EMACS_VERSION=master
+
+install:
+ - $CURL -O
https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz
+ - tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C /
+ - export EMACS=/tmp/emacs/bin/emacs
+
+script:
+ - $EMACS --version
+ - emacs=$EMACS make test
+
+notifications:
+ email:
+ # Default is change, but that includes a new branch's 1st success.
+ on_success: never
+ on_failure: always
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..af3245c7d4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+SHELL = /bin/sh
+EMACS ?= emacs
+FILES = $(filter-out evil-test-helpers.el evil-tests.el evil-pkg.el,$(wildcard
evil*.el))
+PROFILER =
+
+.PHONY: test
+
+# Delete byte-compiled files etc.
+clean:
+ rm -f *~
+ rm -f \#*\#
+ rm -f *.elc
+
+# Run tests.
+test:
+ $(EMACS) -batch -Q -l evil-nerd-commenter-sdk.el -l
evil-nerd-commenter.el -l evil-nerd-commenter-tests.el
+ rm -f *.elc .depend
\ No newline at end of file
diff --git a/evil-nerd-commenter-operator.el b/evil-nerd-commenter-operator.el
index 8c8d056218..3c056ef00d 100644
--- a/evil-nerd-commenter-operator.el
+++ b/evil-nerd-commenter-operator.el
@@ -1,7 +1,5 @@
;;; evil-nerd-commenter-operator.el --- Provides an evil operator for
evil-nerd-commenter
-;; Copyright (C) 2013-2017, Chen Bin
-
;; Author: Chen Bin <chenbin.sh@gmail.com>
;; This file is not part of GNU Emacs.
diff --git a/evil-nerd-commenter-sdk.el b/evil-nerd-commenter-sdk.el
index cc744cff1d..d8bde19bd2 100644
--- a/evil-nerd-commenter-sdk.el
+++ b/evil-nerd-commenter-sdk.el
@@ -1,8 +1,6 @@
;;; evil-nerd-commenter-sdk.el --- SDK used by other files
-;; Copyright (C) 2017 Chen Bin
-
-;; Author: Chen Bin <chenin DOT sh AT gmail DOT com>
+;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com>
;;; License:
diff --git a/evil-nerd-commenter-tests.el b/evil-nerd-commenter-tests.el
new file mode 100644
index 0000000000..d83b64f6a6
--- /dev/null
+++ b/evil-nerd-commenter-tests.el
@@ -0,0 +1,81 @@
+;; evil-nerd-commenter-tests.el --- unit tests for evil-nerd-commenter -*-
coding: utf-8 -*-
+
+;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com>
+
+;;; License:
+
+;; This file is not 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 2, 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, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+(require 'ert)
+(require 'evil-nerd-commenter)
+(require 'js)
+
+(defun evilnc-get-lines (start end)
+ (split-string (buffer-substring-no-properties start end) "\n"))
+
+(ert-deftest evilnc-test-forward-line ()
+ (with-temp-buffer
+ (insert "hello\nworld\nbye\nworld")
+ (goto-char (point-min))
+ (evilnc--forward-line 1)
+ (should (eq (length (evilnc-get-lines (point-min) (point))) 2))
+ (goto-char (point-min))
+ (evilnc--forward-line 2)
+ (should (eq (length (evilnc-get-lines (point-min) (point))) 3))))
+
+(ert-deftest evilnc-test-comment-lines ()
+ (let* (lines)
+ (with-temp-buffer
+ (insert "hello\nworld\nbye\nworld")
+ ;; test js comment
+ (js-mode)
+ (goto-char (point-min))
+ ;; comment out current line
+ (evilnc-comment-or-uncomment-lines 1)
+ (setq lines (evilnc-get-lines (point-min) (line-end-position)))
+ (should (string= (car lines) "// hello"))
+
+ ;; un-comment current line
+ (evilnc-comment-or-uncomment-lines 1)
+ (setq lines (evilnc-get-lines (point-min) (line-end-position)))
+ (should (string= (car lines) "hello"))
+
+ ;; comment multiple lines
+ (goto-char (point-min))
+ (evilnc-comment-or-uncomment-lines 3)
+ (setq lines (evilnc-get-lines (point-min) (point-max)))
+ (should (string= (nth 0 lines) "// hello"))
+ (should (string= (nth 1 lines) "// world"))
+ (should (string= (nth 2 lines) "// bye"))
+ (should (string= (nth 3 lines) "world")))))
+
+(ert-deftest evilnc-test-copy-and-comment-lines ()
+ (let* (lines)
+ (with-temp-buffer
+ (insert "hello\nworld")
+ (js-mode)
+ (goto-char (point-min))
+ (evilnc-copy-and-comment-lines 2)
+ (setq lines (evilnc-get-lines (point-min) (point-max)))
+ (should (string= (nth 0 lines) "// hello"))
+ (should (string= (nth 1 lines) "// world"))
+ (should (string= (nth 2 lines) "hello"))
+ (should (string= (nth 3 lines) "world")))))
+
+(ert-run-tests-batch-and-exit)
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index cbe8d9afcb..647f5c6a97 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -1,8 +1,7 @@
;;; evil-nerd-commenter.el --- Comment/uncomment lines efficiently. Like Nerd
Commenter in Vim
-;; Copyright (C) 2013-2019, Chen Bin
-
;; Author: Chen Bin <chenbin.sh@gmail.com>
+
;; URL: http://github.com/redguardtoo/evil-nerd-commenter
;; Version: 3.3.4
;; Package-Requires: ((emacs "24.4"))
- [nongnu] elpa/evil-nerd-commenter 11998038f3 143/235: default key bindings can define key bindings in non-evil mode, (continued)
- [nongnu] elpa/evil-nerd-commenter 11998038f3 143/235: default key bindings can define key bindings in non-evil mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 7c274dbb7e 147/235: remove extra spaces at end of comment object, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 8b5830a003 145/235: remove obsolete macro, Emacs v23.2 is not my concern, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 31db96711e 162/235: make check-doc happy, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 2d31dfba53 156/235: Merge pull request #77 from madand/do-not-compile-operator-file, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 34d411715e 169/235: fixed issue when stripping trailing comment delimiter characters, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 904d9ee2ed 179/235: comment operator should be compatible with evil-matchit, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 341f78551b 182/235: Fix regression for non-visual modes., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 36304a689b 184/235: tested in Emacs 24.4, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 65bb73ec49 171/235: Update README.org to reflect changes in c68ad3346f528d1cabaef76e3944748e2b8f68b2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter aa34d89797 185/235: add unit test and CI,
ELPA Syncer <=
- [nongnu] elpa/evil-nerd-commenter f7b082d5b2 186/235: add build status into README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 00840b3da4 198/235: Merge pull request #103 from mamapanda/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter fa40dab8d2 208/235: know the text object before operate on it, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 4387407615 209/235: fixed key binding setup, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 60b8862864 210/235: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter b7fc023492 220/235: fixed: `add-to-list’ can’t use lexical var `cands’, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter b8ac35fe01 225/235: add evilnc-yank-and-comment-operator, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter b8a2601117 006/235: some tip, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter ef643d604d 007/235: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter d3581dcf64 014/235: workaround autoconf.el comment bug, ELPA Syncer, 2022/01/06