1
0
Fork 0

Add tests for ‘oni-conf’

This commit is contained in:
Tom Willemse 2019-08-23 23:00:43 -07:00
parent a86af3f8fa
commit 3719d3e7ad
4 changed files with 64 additions and 17 deletions

View file

@ -1,11 +1,21 @@
image: silex/emacs:26.1-alpine-dev
stages:
- test
- pre-package-multifile
- test
- package
- deploy
package-oni-conf:
stage: pre-package-multifile
before_script:
- rm -rf oni-conf/dist
script:
- cask --path oni-conf package
artifacts:
paths:
- oni-conf/dist/
test-oni-alert:
stage: test
script: make test-oni-alert
@ -14,6 +24,13 @@ test-oni-bookmark:
stage: test
script: make test-oni-bookmark
test-oni-conf:
stage: test
dependencies:
- package-oni-conf
needs: [package-oni-conf]
script: make test-oni-conf
test-oni-css:
stage: test
script: make test-oni-css
@ -30,16 +47,6 @@ test-oni-php:
stage: test
script: make test-oni-php
package-oni-conf:
stage: pre-package-multifile
before_script:
- rm -rf oni-conf/dist
script:
- cask --path oni-conf package
artifacts:
paths:
- oni-conf/dist/
package:
stage: package
dependencies:

View file

@ -44,6 +44,7 @@ test-%: install-%
test-oni-css: DEPS := oni-company oni-fci
test-oni-bookmark: DEPS := oni-data-dir
test-oni-php: DEPS := oni-flycheck oni-company oni-fci
test-oni-conf: DEPS := oni-yasnippet
clean:
rm -fv $(FILES)

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 20190613083458
;; Version: 20190823225821
;; Package-Requires: (oni-yasnippet)
;; This program is free software; you can redistribute it and/or modify
@ -34,16 +34,19 @@
(buffer-file-name)))
"The directory where oni-conf was loaded from.")
(defconst oni-conf-snippets-dir
(expand-file-name "snippets" oni-conf-root)
"The director where oni-conf stores its snippets.")
;;;###autoload
(defun oni-conf-snippets-initialize ()
"Initialize the snippets for oni-conf."
(let ((snippets-dir (expand-file-name "snippets" oni-conf-root)))
(when (boundp 'yas-snippet-dirs)
(add-to-list 'yas-snippet-dirs snippets-dir t))
(yas-load-directory snippets-dir)))
(when (boundp 'yas-snippet-dirs)
(add-to-list 'yas-snippet-dirs oni-conf-snippets-dir t))
(yas-load-directory oni-conf-snippets-dir))
;;;###autoload
(with-eval-after-load 'oni-conf
(with-eval-after-load 'conf-mode
(with-eval-after-load 'yasnippet
(oni-conf-snippets-initialize)))

36
test/oni-conf-test.el Normal file
View file

@ -0,0 +1,36 @@
;;; oni-conf-test.el --- Tests for oni-conf -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; 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 <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'oni-conf)
(ert-deftest oni-conf-test-autoloads ()
"Test that snippets get loaded autmatically."
(require 'conf-mode)
(require 'yasnippet)
(should (member oni-conf-snippets-dir yas-snippet-dirs)))
(provide 'oni-conf-test)
;;; oni-conf-test.el ends here