emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 44c166c198 06/14: Restore test


From: ELPA Syncer
Subject: [elpa] externals/compat 44c166c198 06/14: Restore test
Date: Tue, 3 Jan 2023 20:57:29 -0500 (EST)

branch: externals/compat
commit 44c166c198078db12fe9035db8eeb9cc5aa4f9cb
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Restore test
---
 compat-tests.el | 79 +++++++++++++++++++++------------------------------------
 1 file changed, 29 insertions(+), 50 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index d86676f1ca..94c1962720 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -157,6 +157,35 @@
     (should (equal (compat-alist-get "one" alist-2 nil nil #'string=)
                    "eins"))))
 
+(ert-deftest compat-json-serialize ()
+  "Check if `json-serialize' was implemented properly."
+  (let ((input-1 '((:key . ["abc" 2]) (yek . t)))
+        (input-2 '(:key ["abc" 2] yek t))
+        (input-3 (let ((ht (make-hash-table)))
+                   (puthash "key" ["abc" 2] ht)
+                   (puthash "yek" t ht)
+                   ht)))
+    (should (equal (json-serialize input-1)
+                   "{\":key\":[\"abc\",2],\"yek\":true}"))
+    (should (equal (json-serialize input-2)
+                   "{\"key\":[\"abc\",2],\"yek\":true}"))
+    (should (member (json-serialize input-2)
+                    '("{\"key\":[\"abc\",2],\"yek\":true}"
+                      "{\"yek\":true,\"key\":[\"abc\",2]}")))
+    (should-error (json-serialize '(("a" . 1)))
+                  :type '(wrong-type-argument symbolp "a"))
+    (should-error (json-serialize '("a" 1))
+                  :type '(wrong-type-argument symbolp "a"))
+    (should-error (json-serialize '("a" 1 2))
+                  :type '(wrong-type-argument symbolp "a"))
+    (should-error (json-serialize '(:a 1 2))
+                  :type '(wrong-type-argument consp nil))
+    (should-error (json-serialize
+                   (let ((ht (make-hash-table)))
+                     (puthash 'a 1 ht)
+                     ht))
+                  :type '(wrong-type-argument stringp a))))
+
 (ert-deftest compat-json-parse-string ()
   "Check if `compat--t-json-parse-string' was implemented properly."
   (let ((input "{\"key\":[\"abc\", 2], \"yek\": null}"))
@@ -1254,56 +1283,6 @@
 ;;   (ought 'foo "null" :null-object 'foo)
 ;;   (ought ["false" t] "[false, true]" :false-object "false"))
 
-;; (ert-deftest compat-json-serialize ()
-;;   "Check if `json-serialize' was implemented properly."
-;;   (let ((input-1 '((:key . ["abc" 2]) (yek . t)))
-;;         (input-2 '(:key ["abc" 2] yek t))
-;;         (input-3 (let ((ht (make-hash-table)))
-;;                    (puthash "key" ["abc" 2] ht)
-;;                    (puthash "yek" t ht)
-;;                    ht)))
-;;     (should (equal (json-serialize input-1)
-;;                    "{\":key\":[\"abc\",2],\"yek\":true}"))
-;;     (should (equal (json-serialize input-2)
-;;                    "{\"key\":[\"abc\",2],\"yek\":true}"))
-;;     (should (member (json-serialize input-2)
-;;                     '("{\"key\":[\"abc\",2],\"yek\":true}"
-;;                       "{\"yek\":true,\"key\":[\"abc\",2]}")))
-;;     (should-error (json-serialize '(("a" . 1)))
-;;                   :type '(wrong-type-argument symbolp "a"))
-;;     (should-error (json-serialize '("a" 1))
-;;                   :type '(wrong-type-argument symbolp "a"))
-;;     (should-error (json-serialize '("a" 1 2))
-;;                   :type '(wrong-type-argument symbolp "a"))
-;;     (should-error (json-serialize '(:a 1 2))
-;;                   :type '(wrong-type-argument consp nil))
-;;     (should-error (json-serialize
-;;                    (let ((ht (make-hash-table)))
-;;                      (puthash 'a 1 ht)
-;;                      ht))
-;;                   :type '(wrong-type-argument stringp a))
-;;     (when (fboundp 'json-serialize)
-;;       (should (equal (json-serialize input-1)
-;;                      "{\":key\":[\"abc\",2],\"yek\":true}"))
-;;       (should (equal (json-serialize input-2)
-;;                      "{\"key\":[\"abc\",2],\"yek\":true}"))
-;;       (should (member (json-serialize input-2)
-;;                       '("{\"key\":[\"abc\",2],\"yek\":true}"
-;;                         "{\"yek\":true,\"key\":[\"abc\",2]}")))
-;;       (should-error (json-serialize '(("a" . 1)))
-;;                     :type '(wrong-type-argument symbolp "a"))
-;;       (should-error (json-serialize '("a" 1))
-;;                     :type '(wrong-type-argument symbolp "a"))
-;;       (should-error (json-serialize '("a" 1 2))
-;;                     :type '(wrong-type-argument symbolp "a"))
-;;       (should-error (json-serialize '(:a 1 2))
-;;                     :type '(wrong-type-argument consp nil))
-;;       (should-error (json-serialize
-;;                      (let ((ht (make-hash-table)))
-;;                        (puthash 'a 1 ht)
-;;                        ht))
-;;                     :type '(wrong-type-argument stringp a)))))
-
 ;; (compat-deftests compat-lookup-key
 ;;   (let ((a-map (make-sparse-keymap))
 ;;         (b-map (make-sparse-keymap)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]