diff options
author | Sam Brightman <sambrightman@users.noreply.github.com> | 2018-01-27 12:02:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 12:02:36 +0000 |
commit | 28af1ab1217c46367ab5f29d72a57fcc6d9cd45e (patch) | |
tree | 530fdc9e277880d6f333098ad4ebf7c822179563 | |
parent | a731251e2a17843de6456c9568b533e17b9560cc (diff) | |
parent | b41b35c848166fa01826429e6e19da694ae78df7 (diff) |
Merge pull request #35 from sambrightman/minimum-version-tests
Add tests for minimum package version
-rw-r--r-- | test/epl-test.el | 36 | ||||
-rw-r--r-- | test/resources/versioned-package-new.el | 32 | ||||
-rw-r--r-- | test/resources/versioned-package.el | 32 |
3 files changed, 100 insertions, 0 deletions
diff --git a/test/epl-test.el b/test/epl-test.el index 7d68494..31a88ac 100644 --- a/test/epl-test.el +++ b/test/epl-test.el @@ -200,6 +200,42 @@ package.el tends to have such unfortunate side effects." (epl-package-delete package) (should-not (epl-package-installed-p package)))))) +(ert-deftest epl-package-installed-p/min-version () + (epl-test/with-sandbox + (let ((package-file (epl-test-resource-file-name "versioned-package.el")) + (new-package-file (epl-test-resource-file-name "versioned-package-new.el"))) + (epl-install-file package-file) + (let ((package (car (epl-find-installed-packages 'versioned-package)))) + (should (epl-package-installed-p package)) + (should (epl-package-installed-p package (version-to-list "8.2.10"))) + (should (epl-package-installed-p package (version-to-list "8.2.9"))) + (should (epl-package-installed-p package (version-to-list "8.2"))) + (should (epl-package-installed-p package (version-to-list "8"))) + (should-not (epl-package-installed-p package (version-to-list "8.2.11"))) + (should-not (epl-package-installed-p package (version-to-list "8.3.10"))) + (should-not (epl-package-installed-p package (version-to-list "9.1.6"))) + (should-not (epl-package-installed-p package (version-to-list "999999"))))))) + +(ert-deftest epl-package-installed-p/min-version-upgrade () + (epl-test/with-sandbox + (let ((package-file (epl-test-resource-file-name "versioned-package.el")) + (new-package-file (epl-test-resource-file-name "versioned-package-new.el"))) + (epl-install-file package-file) + (let ((package (car (epl-find-installed-packages 'versioned-package)))) + (should (epl-package-installed-p package)) + (should-not (epl-package-installed-p package (version-to-list "9.1.6"))) + (epl-install-file new-package-file) + (let ((package (car (epl-find-installed-packages 'versioned-package)))) + (should (epl-package-installed-p package)) + (should (epl-package-installed-p package (version-to-list "8.2.10"))) + (should (epl-package-installed-p package (version-to-list "8.2.9"))) + (should (epl-package-installed-p package (version-to-list "8.2"))) + (should (epl-package-installed-p package (version-to-list "8"))) + (should (epl-package-installed-p package (version-to-list "8.2.11"))) + (should (epl-package-installed-p package (version-to-list "8.3.10"))) + (should (epl-package-installed-p package (version-to-list "9.1.6"))) + (should-not (epl-package-installed-p package (version-to-list "999999")))))))) + (provide 'epl-test) ;;; epl-test.el ends here diff --git a/test/resources/versioned-package-new.el b/test/resources/versioned-package-new.el new file mode 100644 index 0000000..7dd2b43 --- /dev/null +++ b/test/resources/versioned-package-new.el @@ -0,0 +1,32 @@ +;;; versioned-package.el --- EPL: Dummy package for unit tests -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Sam Brightman + +;; Author: Sam Brightman <sam.brightman@gmail.com> +;; Version: 9.1.6 + +;; 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 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; A dummy package to test EPL + +;;; Code: + + +(provide 'versioned-package) + +;;; versioned-package.el ends here diff --git a/test/resources/versioned-package.el b/test/resources/versioned-package.el new file mode 100644 index 0000000..4e39d0d --- /dev/null +++ b/test/resources/versioned-package.el @@ -0,0 +1,32 @@ +;;; versioned-package.el --- EPL: Dummy package for unit tests -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Sam Brightman + +;; Author: Sam Brightman <sam.brightman@gmail.com> +;; Version: 8.2.10 + +;; 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 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; A dummy package to test EPL + +;;; Code: + + +(provide 'versioned-package) + +;;; versioned-package.el ends here |