diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-06 09:00:10 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-06 09:04:13 +0000 |
commit | 18c5a08dfb377d13afe463f5892ee2aa575b9e66 (patch) | |
tree | f64366a806ca127ad993a1eb494b2c86ca6952fb /test/tests.el | |
parent | 35dc5c5a572a1fbf8e21195f98b3089f22c68775 (diff) |
Add tests for the question-list
Diffstat (limited to 'test/tests.el')
-rw-r--r-- | test/tests.el | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/tests.el b/test/tests.el index efad2d0..9bf63fd 100644 --- a/test/tests.el +++ b/test/tests.el @@ -6,7 +6,10 @@ (unintern symbol))))) ;;; Tests -(defvar stack-test-data-dir "data-samples/" +(defvar stack-test-data-dir + (expand-file-name + "data-samples/" + (or load-file-name "./")) "") (defun stack-test-sample-data (method &optional directory) @@ -31,10 +34,11 @@ (require 'stack-core) (require 'stack-question) +(require 'stack-question-list) (ert-deftest test-basic-request () - "Test basic request functionality" - (should (stack-core-make-request "sites"))) + "Test basic request functionality" + (should (stack-core-make-request "sites"))) (ert-deftest test-question-retrieve () "Test the ability to receive a list of questions." @@ -53,7 +57,7 @@ '((1 . t) (2 . [1 2]) (3)) (stack-core-filter-data '((0 . 3) (1 . t) (a . five) (2 . [1 2]) ("5" . bop) (3) (p . 4)) - '(1 2 3)))) + '(1 2 3)))) ;; complex (should (equal @@ -97,3 +101,16 @@ (delete-file (stack-cache-get-file-name stack-filter-cache-file)))) + +(ert-deftest question-list-display () + (cl-letf (((symbol-function 'stack-core-make-request) + (lambda (&rest _) stack-test-data-questions))) + (call-interactively 'list-questions)) + (goto-char (point-min)) + (should (looking-at " 1 0 Focus-hook: attenuate colours when losing focus [0-9]+d ago \\[frames\\] \\[hooks\\] \\[focus\\]")) + (stack-question-list-next 5) + (should (looking-at " 0 1 Babel doesn't wrap results in verbatim [0-9]+d ago \\[org-mode\\]")) + (call-interactively 'stack-question-list-display-question) + (should (equal (buffer-name) "*stack-question*")) + (stack-question-list-previous 4) + (should (looking-at " 2 1 "Making tag completion table" Freezes/Blocks -- how to disable [0-9]+d ago \\[autocomplete\\]"))) |