aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorStephen Leake2019-04-14 09:24:42 -0700
committerStephen Leake2019-04-14 09:24:42 -0700
commit5ee5895f9b7b829783bc0f217095748076cc77e9 (patch)
tree82eb5163502b447425eba24d2d368e878813ab77 /test/src
parentca449fb1c1f86589cbf4da49cda1750ffdb2cad4 (diff)
parent890440a44cd5f4f09742f521c7783785d114fffc (diff)
downloademacs-5ee5895f9b7b829783bc0f217095748076cc77e9.tar.gz
emacs-5ee5895f9b7b829783bc0f217095748076cc77e9.zip
Merge commit '890440a44cd5f4f09742f521c7783785d114fffc'
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el18
-rw-r--r--test/src/json-tests.el8
2 files changed, 26 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index d6cc99e8e33..6ebab4287f7 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -648,4 +648,22 @@
648 (should (equal (list (eq a b) n len) 648 (should (equal (list (eq a b) n len)
649 (list t n len)))))))) 649 (list t n len))))))))
650 650
651(ert-deftest test-proper-list-p ()
652 "Test `proper-list-p' behavior."
653 (dotimes (length 4)
654 ;; Proper and dotted lists.
655 (let ((list (make-list length 0)))
656 (should (= (proper-list-p list) length))
657 (should (not (proper-list-p (nconc list 0)))))
658 ;; Circular lists.
659 (dotimes (n (1+ length))
660 (let ((circle (make-list (1+ length) 0)))
661 (should (not (proper-list-p (nconc circle (nthcdr n circle))))))))
662 ;; Atoms.
663 (should (not (proper-list-p 0)))
664 (should (not (proper-list-p "")))
665 (should (not (proper-list-p [])))
666 (should (not (proper-list-p (make-bool-vector 0 nil))))
667 (should (not (proper-list-p (make-symbol "a")))))
668
651(provide 'fns-tests) 669(provide 'fns-tests)
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 04f91f4abbc..542eec11bf3 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -117,6 +117,14 @@
117 (should (equal (json-parse-string input :object-type 'plist) 117 (should (equal (json-parse-string input :object-type 'plist)
118 '(:abc [9 :false] :def :null))))) 118 '(:abc [9 :false] :def :null)))))
119 119
120(ert-deftest json-parse-string/array ()
121 (skip-unless (fboundp 'json-parse-string))
122 (let ((input "[\"a\", 1, [\"b\", 2]]"))
123 (should (equal (json-parse-string input)
124 ["a" 1 ["b" 2]]))
125 (should (equal (json-parse-string input :array-type 'list)
126 '("a" 1 ("b" 2))))))
127
120(ert-deftest json-parse-string/string () 128(ert-deftest json-parse-string/string ()
121 (skip-unless (fboundp 'json-parse-string)) 129 (skip-unless (fboundp 'json-parse-string))
122 (should-error (json-parse-string "[\"formfeed\f\"]") :type 'json-parse-error) 130 (should-error (json-parse-string "[\"formfeed\f\"]") :type 'json-parse-error)