branch: externals/tomelr
commit 5959b90ffa499281306473c83b669353ecb85073
Author: Kaushal Modi <[email protected]>
Commit: Kaushal Modi <[email protected]>
fix: Don't let TOML tables be recognized as TOML tables arrays
---
test/tinternal.el | 15 +++++++++++++++
tomelr.el | 3 ++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/test/tinternal.el b/test/tinternal.el
index b80950b434..5b4e1bb5d8 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -44,5 +44,20 @@
(dolist (el inp)
(should (equal nil (tomelr--toml-table-p el))))))
+;;;; tomelr--toml-table-array-p
+(ert-deftest test-internal-valid-tta ()
+ (let ((inp '(
+ (((a . 1)))
+ )))
+ (dolist (el inp)
+ (should (equal t (tomelr--toml-table-array-p el))))))
+
+(ert-deftest test-internal-invalid-tta ()
+ (let ((inp '(
+ ((a . 1)) ;This is a TOML table
+ )))
+ (dolist (el inp)
+ (should (equal nil (tomelr--toml-table-array-p el))))))
+
(provide 'tinternal)
diff --git a/tomelr.el b/tomelr.el
index c6ef0ba4f8..2c3ed32b74 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -378,7 +378,8 @@ Definition of a TOML Table Array (TTA):
- OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
TOML Table (TT)."
- (when (and (not (stringp object))
+ (when (and (not (tomelr--toml-table-p object))
+ (not (stringp object))
(mapp object)) ;Because `mapp' is non-nil for strings too
(seq-every-p
(lambda (elem)