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

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

[elpa] externals/tomelr 0eb4fa04ac 43/84: fix: Don't let array of TOML t


From: ELPA Syncer
Subject: [elpa] externals/tomelr 0eb4fa04ac 43/84: fix: Don't let array of TOML tables be recognized as TOML tables
Date: Tue, 3 May 2022 09:58:11 -0400 (EDT)

branch: externals/tomelr
commit 0eb4fa04ac3e6741f743ba451b1ec7a019989b5e
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>

    fix: Don't let array of TOML tables be recognized as TOML tables
---
 test/tinternal.el |  3 ++-
 tomelr.el         | 19 ++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/test/tinternal.el b/test/tinternal.el
index 9564b5c9af..b80950b434 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -38,7 +38,8 @@
 (ert-deftest test-internal-invalid-toml-tables ()
   (let ((inp '(
                (a 1)
-               ;; (((a . 1)))             ;This is an array of TOML table
+               ((:a 1))                ;This is an array of TOML table
+               (((a . 1)))             ;This is an array of TOML table
                )))
     (dolist (el inp)
       (should (equal nil (tomelr--toml-table-p el))))))
diff --git a/tomelr.el b/tomelr.el
index edbf7e6aa4..c6ef0ba4f8 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -270,11 +270,11 @@ Definition of a TOML Table (TT):
   OBJECT is a nested TT.  In that case, pass (WHATEVER) to
   `tomelr--toml-table-p'."
   (let (tablep)
-    ;; (message "[tomelr--toml-table-p DBG] object = %S, type = %S, mapp = %S, 
length = %d"
-    ;;          object (type-of object) (mapp object) (safe-length object))
+    ;; (message "[tomelr--toml-table-p DBG] object = %S, type = %S, len = %d"
+    ;;          object (type-of object) (safe-length object))
     (when (listp object)
-      ;; (message "[tomelr--toml-table-p DBG] first elem = %S, type = %S"
-      ;;          (car object) (type-of (car object)))
+      ;; (message "[tomelr--toml-table-p DBG] first elem = %S, type = %S, len 
= %d"
+      ;;          (car object) (type-of (car object)) (safe-length (car 
object)))
       (setq tablep
             (cond
              ((json-plist-p object)
@@ -283,13 +283,14 @@ Definition of a TOML Table (TT):
                ;; Ensure that every element in the `object' is a (KEY
                ;; . VAL) kind of cons.
                (lambda (elem)
-                 ;; (message "  [tomelr--toml-table-p DBG] elem = %S, type = 
%S"
-                 ;;          elem (type-of elem))
+                 ;; (message "  [tomelr--toml-table-p DBG] elem = %S, type = 
%S, len = %d"
+                 ;;          elem (type-of elem) (safe-length elem))
                  ;; (when (listp elem)
-                 ;;   (message "  [tomelr--toml-table-p DBG] sub-elem 0 = %S, 
type = %S"
-                 ;;            (nth 0 elem) (type-of (nth 0 elem))))
+                 ;;   (message "  [tomelr--toml-table-p DBG] sub-elem 0 = %S, 
type = %S, len = %d"
+                 ;;            (car elem) (type-of (car elem)) (safe-length 
(car elem))))
                  (and (consp elem)
-                      (= 1 (safe-length elem))))
+                      (= 1 (safe-length elem))
+                      (not (consp (car elem)))))
                object)
               t)
              ((and (listp (car object))



reply via email to

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