diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-07 20:53:46 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-07 20:53:46 -0200 |
commit | ed981ba21cbd34a6eb0d2f1c67f137a547f8b09e (patch) | |
tree | 167f7bbf8aafecf27845d46e3978eaaf09918109 /test/test-printing.el | |
parent | a16341cdf93224a399d3b64a8d50c32ce4323f08 (diff) |
Moar tests!
Diffstat (limited to 'test/test-printing.el')
-rw-r--r-- | test/test-printing.el | 39 |
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"])))))) |