diff options
author | Sebastian Wiesner <lunaryorn@gmail.com> | 2013-11-01 13:10:15 +0100 |
---|---|---|
committer | Sebastian Wiesner <lunaryorn@gmail.com> | 2013-11-01 13:10:15 +0100 |
commit | f8fc0671d64f758f59857551dbaf4d26cbb71c44 (patch) | |
tree | 0aae54a7ff34fd2339cf0a4efae67a66a1f4d0ee /test | |
parent | b2334101fa85d4f6b314fd6e93fb7492a5cc910a (diff) |
Explode the test cases
Just a single assertion per test!
Diffstat (limited to 'test')
-rw-r--r-- | test/pkg-info-test.el | 70 |
1 files changed, 53 insertions, 17 deletions
diff --git a/test/pkg-info-test.el b/test/pkg-info-test.el index a5b69bc..2b88bf7 100644 --- a/test/pkg-info-test.el +++ b/test/pkg-info-test.el @@ -36,39 +36,75 @@ (insert-file-contents (find-library-name "ruby-mode")) (version-to-list (lm-header "Version")))) -(ert-deftest pkg-info-library-version-feature () - (should (equal (pkg-info-library-version 'pkg-info-dummy-package) '(3 4 2 1))) +(ert-deftest pkg-info-library-version/feature-exists () + (should (equal (pkg-info-library-version 'pkg-info-dummy-package) '(3 4 2 1)))) + +(ert-deftest pkg-info-library-version/builtin-feature () (should (equal (pkg-info-library-version 'ruby-mode) - pkg-info-ruby-mode-version)) - (should-error (pkg-info-library-version 'no-such-feature)) + pkg-info-ruby-mode-version))) + +(ert-deftest pkg-info-library-version/feature-does-not-exist () + (should-error (pkg-info-library-version 'no-such-feature))) + +(ert-deftest pkg-info-library-version/loaded-feature-outside-load-path () + :expected-result 'failed ;; TODO: Fails? We must find a way to get the defining file of a `require' - ;; (should (equal (pkg-info-library-version 'pkg-info) (pkg-info-version))) - ) + (should (equal (pkg-info-library-version 'pkg-info) (pkg-info-version)))) -(ert-deftest pkg-info-library-version-filename () +(ert-deftest pkg-info-library-version/library-exists () (should (equal (pkg-info-library-version "pkg-info-dummy-package.el") - '(3 4 2 1))) + '(3 4 2 1)))) + +(ert-deftest pkg-info-library-version/library-does-not-exist () (should-error (pkg-info-library-version "no-such-library"))) -(ert-deftest pkg-info-defining-library-version () +(ert-deftest pkg-info-defining-library-version/defined-function () (should (equal (pkg-info-defining-library-version #'pkg-info-dummy-package-dummy-function) - '(3 4 2 1))) - (should-error (pkg-info-defining-library-version #'this-is-no-function)) + '(3 4 2 1)))) + +(ert-deftest pkg-info-defining-library-version/undefined-function () + (should-error (pkg-info-defining-library-version #'this-is-no-function))) + +(ert-deftest pkg-info-defining-library-version/anonymous-function-without-source () (should-error (pkg-info-defining-library-version (lambda () "foo")))) -(ert-deftest pkg-info-package-version () - (should (equal (pkg-info-package-version 'pkg-info-dummy-package) '(3 4 2 1))) +(ert-deftest pkg-info-package-version/installed-package () + (should (equal (pkg-info-package-version 'pkg-info-dummy-package) '(3 4 2 1)))) + +(ert-deftest pkg-info-package-version/package-does-not-exist () (should-error (pkg-info-package-version 'no-such-package))) -(ert-deftest pkg-info-version-info () - (should (equal (pkg-info-version-info 'pkg-info-dummy-package) "3.4.2.1")) +(ert-deftest pkg-info-version-info/feature-and-package-are-the-same () + (should (equal (pkg-info-version-info 'pkg-info-dummy-package) "3.4.2.1"))) + +(ert-deftest pkg-info-version-info/library-and-package-are-the-same () + (should (equal (pkg-info-version-info "pkg-info-dummy-package") "3.4.2.1"))) + +(ert-deftest pkg-info-version-info/feature-and-package-are-different () (should (equal (pkg-info-version-info 'ruby-mode 'pkg-info-dummy-package) (format "%s (package 3.4.2.1)" (pkg-info-format-version pkg-info-ruby-mode-version))))) -(ert-deftest pkg-info-format-version () - (should (equal (pkg-info-format-version '(3 4 2 1)) "3.4.2.1")) +(ert-deftest pkg-info-version-info/library-and-package-are-different () + (should (equal (pkg-info-version-info "ruby-mode" 'pkg-info-dummy-package) + (format "%s (package 3.4.2.1)" + (pkg-info-format-version pkg-info-ruby-mode-version))))) + +(ert-deftest pkg-info-version-info/package-does-not-exist () + (should (equal (pkg-info-version-info 'pkg-info-dummy-package 'no-such-package) + "3.4.2.1"))) + +(ert-deftest pkg-info-version-info/feature-does-not-exist () + (should-error (pkg-info-version-info 'no-such-library))) + +(ert-deftest pkg-info-version-info/library-does-not-exist () + (should-error (pkg-info-version-info "no-such-library"))) + +(ert-deftest pkg-info-format-version/release-version () + (should (equal (pkg-info-format-version '(3 4 2 1)) "3.4.2.1"))) + +(ert-deftest pkg-info-format-version/prerelease-version () (should (equal (pkg-info-format-version '(2 1 -3)) "2.1alpha"))) ;; Local Variables: |