From 7da9b2567c2635dfab5f9400fb76297f61b80be4 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 1 Jan 2015 16:57:49 -0500 Subject: Test sx-time-since --- test/test-printing.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test-printing.el b/test/test-printing.el index 6225bf6..60382b2 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -27,6 +27,18 @@ after being run through `sx-question--tag-format'." ;;; Tests +(ert-deftest time-since () + (cl-letf (((symbol-function #'float-time) + (lambda () 1420148997.))) + (should + (string= + "67m" + (sx-time-since 1420145000.))) + (should + (string= + "12h" + (sx-time-since 1420105000.))))) + (ert-deftest question-list-tag () "Test `sx-question--tag-format'." (should -- cgit v1.2.3 From 54849b2564c3d9bb95bc3512b568e30aa21a3db4 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 1 Jan 2015 23:29:55 -0500 Subject: Update Makefile Clean compiled files before every test. This ensures that the changes made during the current session are applied when re-testing. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 7b0b698..a72bea1 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ $(VERSIONS) :: evm use emacs-24.$@-bin emacs --version cask install + cask clean-elc emacs --batch -L . -l ert -l test/tests.el -f ert-run-tests-batch-and-exit install_cask: -- cgit v1.2.3 From 3b275a93789a568d23ece65086ffebb8de430f3a Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 1 Jan 2015 23:40:20 -0500 Subject: Add test for user entry functions --- test/tests.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/tests.el b/test/tests.el index d709600..7bfc86c 100644 --- a/test/tests.el +++ b/test/tests.el @@ -59,3 +59,19 @@ (mapc #'sx-load-test '(api macros printing util)) + +(ert-deftest user-entry-functions () + "Ensures all entry functions are autoloaded." + (should + (cl-every + #'fboundp + '(sx-ask + sx-authenticate + sx-bug-report + sx-tab-frontpage + sx-tab-hot + sx-tab-month + sx-tab-newest + sx-tab-topvoted + sx-tab-week + sx-version)))) -- cgit v1.2.3 From 7a75cd61e822a4895b85bc17780b163bd6876ca7 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Sun, 4 Jan 2015 17:26:16 -0500 Subject: Add more autoloads to test --- test/tests.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/tests.el b/test/tests.el index 5eec57c..493d7dc 100644 --- a/test/tests.el +++ b/test/tests.el @@ -69,10 +69,14 @@ '(sx-ask sx-authenticate sx-bug-report + sx-switchto-map + sx-tab-featured sx-tab-frontpage sx-tab-hot sx-tab-month sx-tab-newest + sx-tab-starred sx-tab-topvoted + sx-tab-unanswered sx-tab-week sx-version)))) -- cgit v1.2.3 From 802f778bb28506d9be92618913c8db0cb4eda539 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Fri, 16 Jan 2015 12:42:53 -0200 Subject: load test-state --- test/tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tests.el b/test/tests.el index 493d7dc..be1552b 100644 --- a/test/tests.el +++ b/test/tests.el @@ -59,7 +59,7 @@ (apply #'message message args))) (mapc #'sx-load-test - '(api macros printing util search)) + '(api macros printing util search state)) (ert-deftest user-entry-functions () "Ensures all entry functions are autoloaded." -- cgit v1.2.3 From 148da420d9f464f3cc8046fed99a103af0fd7bed Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Fri, 16 Jan 2015 12:52:14 -0200 Subject: Test displaying a question --- test/test-printing.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test-printing.el b/test/test-printing.el index 677dca3..9512a5e 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -146,6 +146,14 @@ after being run through `sx-question--tag-format'." (should (equal object '((answers . [something "answer"])))))) + +;;; question-mode +(ert-deftest sx-display-question () + (should + (sx-display-question sx-test-data-questions)) + (should-error + (sx-display-question sx-test-data-questions nil 1))) + (ert-deftest sx-question-mode--fill-and-fontify () "Check complicated questions are filled correctly." (should @@ -202,3 +210,4 @@ if you used the Stack Exchange login method, you'd... [1]: http://i.stack.imgur.com/ktFTs.png [2]: http://i.stack.imgur.com/5l2AY.png [3]: http://i.stack.imgur.com/22myl.png"))) + -- cgit v1.2.3 From 3116757fbbbd2a16a5809d316067338a9492e78f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 3 Feb 2015 13:39:30 -0200 Subject: Fix test --- test/test-printing.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test-printing.el b/test/test-printing.el index 9512a5e..1eea281 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -150,6 +150,8 @@ after being run through `sx-question--tag-format'." ;;; question-mode (ert-deftest sx-display-question () (should + (sx-display-question (elt sx-test-data-questions 0))) + (should-error (sx-display-question sx-test-data-questions)) (should-error (sx-display-question sx-test-data-questions nil 1))) -- cgit v1.2.3 From cf2e0f10498a4fe3f65d20454dee621062d194fd Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 3 Feb 2015 16:32:42 -0200 Subject: Really fix test --- test/test-printing.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test-printing.el b/test/test-printing.el index 1eea281..bcc3dd9 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -149,8 +149,9 @@ after being run through `sx-question--tag-format'." ;;; question-mode (ert-deftest sx-display-question () - (should - (sx-display-question (elt sx-test-data-questions 0))) + ;; Check it doesn't error. + (sx-display-question (elt sx-test-data-questions 0)) + ;; Check it does error. (should-error (sx-display-question sx-test-data-questions)) (should-error -- cgit v1.2.3 From 4ed76728809666cee41336dc5191dcf982806f38 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 3 Feb 2015 16:55:21 -0200 Subject: Don't freak out because question_id is nil. --- sx-question.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sx-question.el b/sx-question.el index 1df4900..1fde1aa 100644 --- a/sx-question.el +++ b/sx-question.el @@ -148,7 +148,8 @@ See `sx-question--user-read-list'." ;; Question wasn't present. (t (sx-sorted-insert-skip-first - q-cell site-cell (lambda (x y) (> (car x) (car y)))))))) + q-cell site-cell + (lambda (x y) (> (or (car x) -1) (or (car y) -1)))))))) ;; Save the results. ;; @TODO This causes a small lag on `j' and `k' as the list gets ;; large. Should we do this on a timer? -- cgit v1.2.3