aboutsummaryrefslogtreecommitdiff
path: root/test/test-printing.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-01-07 20:53:46 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-01-07 20:53:46 -0200
commited981ba21cbd34a6eb0d2f1c67f137a547f8b09e (patch)
tree167f7bbf8aafecf27845d46e3978eaaf09918109 /test/test-printing.el
parenta16341cdf93224a399d3b64a8d50c32ce4323f08 (diff)
Moar tests!
Diffstat (limited to 'test/test-printing.el')
-rw-r--r--test/test-printing.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test-printing.el b/test/test-printing.el
index 4d89b4d..10b1d06 100644
--- a/test/test-printing.el
+++ b/test/test-printing.el
@@ -94,3 +94,42 @@ after being run through `sx-question--tag-format'."
(string=
(sx-user--format "%@" '((display_name . "ĤÞßĐŁŘĞĜÝŸÑŃŚŞŠŜŻŹŽÇĆČĈÙÚÛÜŬŮÒÓÔÕÖØŐÐÌÍÎÏıÈÉÊËĘÀÅÁÂÄÃÅĄĴ")))
"@HTHssDLRGGYYNNSSSSZZZCCCCUUUUUUOOOOOOOOIIIIiEEEEEAAAAAAAAJ")))
+
+(ert-deftest sx-object-modification ()
+ "Test adding things to objects"
+ (let ((object (list (cons 'owner "me"))))
+ (should
+ (equal (sx--ensure-owner-in-object 1 object)
+ '((owner . "me"))))
+ (should
+ (equal object '((owner . "me")))))
+ (let ((object (list (cons 'not-owner "me"))))
+ (should
+ (equal (sx--ensure-owner-in-object 1 object)
+ '((owner . 1) (not-owner . "me"))))
+ (should
+ (equal object '((owner . 1) (not-owner . "me")))))
+ (let ((object (list (cons 'comments [something]))))
+ (should
+ (equal (sx--add-comment-to-object "comment" object)
+ '((comments . [something "comment"]))))
+ (should
+ (equal object '((comments . [something "comment"])))))
+ (let ((object (list (cons 'not-comments [something]))))
+ (should
+ (equal (sx--add-comment-to-object "comment" object)
+ '((comments . ["comment"]) (not-comments . [something]))))
+ (should
+ (equal object '((comments . ["comment"]) (not-comments . [something])))))
+ (let ((object (list (cons 'not-answers [something]))))
+ (should
+ (equal (sx--add-answer-to-question-object "answer" object)
+ '((answers . ["answer"]) (not-answers . [something]))))
+ (should
+ (equal object '((answers . ["answer"]) (not-answers . [something])))))
+ (let ((object (list (cons 'answers [something]))))
+ (should
+ (equal (sx--add-answer-to-question-object "answer" object)
+ '((answers . [something "answer"]))))
+ (should
+ (equal object '((answers . [something "answer"]))))))