diff --git a/oni-groovy.el b/oni-groovy.el index cb6be5e..69036a8 100644 --- a/oni-groovy.el +++ b/oni-groovy.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.1210.230729 -;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters) +;; Version: 2020.1019.090337 +;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters jenkinsfile-mode) ;; 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 @@ -42,6 +42,9 @@ (add-hook 'groovy-mode-hook 'rainbow-delimiters-mode) (add-hook 'groovy-mode-hook 'oni-groovy--auto-fill-mode) +;;;###autoload +(add-to-list 'auto-mode-alist `(,(rx ".pipeline" string-end) . jenkinsfile-mode)) + ;;;###autoload(with-eval-after-load 'groovy-mode (require 'oni-groovy)) (provide 'oni-groovy) diff --git a/test/integration/oni-groovy.bats b/test/integration/oni-groovy.bats new file mode 100755 index 0000000..5a768a3 --- /dev/null +++ b/test/integration/oni-groovy.bats @@ -0,0 +1,41 @@ +#!/usr/bin/env bats + +@test "Opening a .groovy file loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit test.groovy \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a Jenkinsfile loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit Jenkinsfile \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a .pipeline file loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit test.pipeline \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a .pipeline file loads jenkinsfile-mode" { + run emacs -batch -l package -f package-initialize \ + -visit "test.pipeline" \ + -eval "(prin1 major-mode)" + + echo "$output" + + [[ "$output" == *"jenkinsfile-mode" ]] +}