Skip to content

Commit

Permalink
fix: Don't let TOML tables be recognized as TOML tables arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Apr 30, 2022
1 parent 0eb4fa0 commit 5959b90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions test/tinternal.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion tomelr.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5959b90

Please sign in to comment.