aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-04 14:07:40 -0500
committerSean Allred <code@seanallred.com>2015-01-04 14:07:40 -0500
commit01df71244d3fe5412e2420127dcd2282d9fa39c7 (patch)
tree0fe936bfa609ea19c454cdcb4d1c2349d5c0c746 /test
parent59327f6f9c6ba419543c47670a62af0aa41271ca (diff)
parent89834aa61adf1fff29379c82ab96629f0b2960d0 (diff)
Merge branch 'master' into filter-macro
Conflicts: sx-filter.el
Diffstat (limited to 'test')
-rw-r--r--test/test-state.el22
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))))
+