-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Cask, ERT tests, and Travis builds
- Loading branch information
1 parent
311101b
commit acec4b2
Showing
5 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-L . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
language: emacs-lisp | ||
os: linux | ||
dist: xenial | ||
sudo: false | ||
|
||
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 | ||
- EVM_EMACS=emacs-26.1-travis | ||
- EVM_EMACS=emacs-26.2-travis | ||
- EVM_EMACS=emacs-git-snapshot-travis | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- clang-format-3.8 | ||
|
||
install: | ||
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh | ||
- evm install $EVM_EMACS --use --skip | ||
- cask install | ||
|
||
script: | ||
- clang-format --version | ||
- cask exec ert-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(source gnu) | ||
(source melpa) | ||
|
||
(package-file "clang-format+.el") | ||
|
||
(development | ||
(depends-on "ert-runner")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
|
||
;;; Code: | ||
|
||
(require 'cc-cmds) | ||
(require 'clang-format) | ||
(require 'cl-lib) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
;;; clang-format+-test.el --- Tests for clang-format+ -*- lexical-binding: t; -*- | ||
|
||
(require 'clang-format+) | ||
|
||
(ert-deftest clang-format+:basic-test () | ||
(with-temp-buffer | ||
(c++-mode) | ||
(clang-format+-mode) | ||
(insert "\nclass A {\n\n\n};\n") | ||
(clang-format+-before-save) | ||
(should (equal (buffer-string) | ||
"\nclass A {};\n")))) | ||
|
||
(ert-deftest clang-format+:modified-test () | ||
(with-temp-buffer | ||
(switch-to-buffer (current-buffer)) | ||
(insert "\nclass A {\n\nint foo () {\n\n};\n};\n") | ||
(c++-mode) | ||
(clang-format+-mode) | ||
(previous-line 3) | ||
(insert "\n\n\n") | ||
(clang-format+-before-save) | ||
(should (equal (buffer-string) | ||
"\nclass A {\n\n int foo(){\n\n };\n};\n")))) | ||
|
||
(ert-deftest clang-format+:apply-to-all-test () | ||
(let ((clang-format+-apply-to-modifications-only nil) | ||
(clang-format-style "llvm")) | ||
(with-temp-buffer | ||
(switch-to-buffer (current-buffer)) | ||
(insert "\nclass A {\n public:\nint foo () {\n\n};\n};\n") | ||
(c++-mode) | ||
(clang-format+-mode) | ||
(previous-line 3) | ||
(insert "\n\n\n") | ||
(clang-format+-before-save) | ||
(should (equal (buffer-string) | ||
"\nclass A {\npublic:\n int foo(){\n\n };\n};\n"))))) | ||
|
||
(ert-deftest clang-format+:no-definition-test () | ||
(let ((clang-format+-apply-to-modified-definition nil)) | ||
(with-temp-buffer | ||
(switch-to-buffer (current-buffer)) | ||
(insert "\nclass A {\n\npublic:\n\n};\n") | ||
(c++-mode) | ||
(clang-format+-mode) | ||
(previous-line 2) | ||
(insert " void foo () { }") | ||
(clang-format+-before-save) | ||
(should (equal (buffer-string) | ||
"\nclass A {\n\npublic:\n void foo() {}\n};\n"))))) | ||
|
||
;;; clang-format+-test.el ends here |