From 3719d3e7ad08034f723e8e125b5d6c738b4fb3ce Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 23 Aug 2019 23:00:43 -0700 Subject: [PATCH] =?UTF-8?q?Add=20tests=20for=20=E2=80=98oni-conf=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 29 ++++++++++++++++++----------- GNUmakefile | 1 + oni-conf/oni-conf.el | 15 +++++++++------ test/oni-conf-test.el | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 test/oni-conf-test.el diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 795dffd..f7e76bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/GNUmakefile b/GNUmakefile index 782f062..79a833c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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) diff --git a/oni-conf/oni-conf.el b/oni-conf/oni-conf.el index c5ff9c1..df09da5 100644 --- a/oni-conf/oni-conf.el +++ b/oni-conf/oni-conf.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; 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))) diff --git a/test/oni-conf-test.el b/test/oni-conf-test.el new file mode 100644 index 0000000..b8088fb --- /dev/null +++ b/test/oni-conf-test.el @@ -0,0 +1,36 @@ +;;; oni-conf-test.el --- Tests for oni-conf -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; 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