diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-04 12:56:57 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-04 12:56:57 -0200 |
commit | ebe40543241c902d6e9af12c783ffbcd9b000833 (patch) | |
tree | 22435c5654af34159cc6c88c98b15d65e361c85e /test/test-state.el | |
parent | 3d35ecfbf78bb862eb70c3166f6eb35fd4cb9cce (diff) | |
parent | 5332946380610d5166c2d7b517a817e021130edd (diff) |
Merge pull request #184 from vermiculus/fix-mark-read-logic
Fix mark read logic
Diffstat (limited to 'test/test-state.el')
-rw-r--r-- | test/test-state.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test-state.el b/test/test-state.el new file mode 100644 index 0000000..7af4a64 --- /dev/null +++ b/test/test-state.el @@ -0,0 +1,22 @@ +(defmacro with-question-data (cell id &rest body) + (declare (indent 2)) + `(let ((,cell '((question_id . ,id) + (site_par . "emacs") + (last_activity_date . 1234123456)))) + ,@body)) + +(ert-deftest test-question-mark-read () + "00ccd139248e782cd8316eff65c26aed838c7e46" + (with-question-data q 10 + ;; Check basic logic. + (should (sx-question--mark-read q)) + (should (sx-question--read-p q)) + (should (not (setcdr (assq 10 (cdr (assoc "emacs" sx-question--user-read-list))) nil))) + ;; Don't freak out because the cdr was nil. + (should (not (sx-question--read-p q))) + (should (sx-question--mark-read q))) + (should + (with-question-data q nil + ;; Don't freak out because question_id was nil. + (sx-question--mark-read q)))) + |