branch: externals/tomelr commit 0d4674f782bee99ee36aca079ede57adeccc384f Author: Kaushal Modi <kaushal.m...@gmail.com> Commit: Kaushal Modi <kaushal.m...@gmail.com>
test: Test `tomelr--toml-table-p` --- test/all-tests.el | 2 ++ test/{all-tests.el => tinternal.el} | 36 +++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/test/all-tests.el b/test/all-tests.el index b031e739ec..45c5442ab4 100644 --- a/test/all-tests.el +++ b/test/all-tests.el @@ -21,6 +21,8 @@ (setq load-prefer-newer t) +(require 'tinternal) + (require 'tscalar) (require 'tnil) (require 'tarray) diff --git a/test/all-tests.el b/test/tinternal.el similarity index 52% copy from test/all-tests.el copy to test/tinternal.el index b031e739ec..9564b5c9af 100644 --- a/test/all-tests.el +++ b/test/tinternal.el @@ -1,4 +1,4 @@ -;;; all-tests.el --- Tests for tomelr.el -*- lexical-binding: t; -*- +;; -*- lexical-binding: t; -*- ;; Authors: Kaushal Modi <kaushal.m...@gmail.com> @@ -17,13 +17,31 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <https://www.gnu.org/licenses/>. -;;; Code: +;;; Commentary: -(setq load-prefer-newer t) +;; Tests for some internal functions. -(require 'tscalar) -(require 'tnil) -(require 'tarray) -(require 'ttable) -(require 'ttable-array) -(require 'tplist) +;;; Code: +(require 'tomelr) + +;;;; tomelr--toml-table-p +(ert-deftest test-internal-valid-toml-tables () + (let ((inp '( + ((a . 1)) + (:a 1) + ((a . 1) (b . 2)) + (:a 1 :b 2) + ))) + (dolist (el inp) + (should (equal t (tomelr--toml-table-p el)))))) + +(ert-deftest test-internal-invalid-toml-tables () + (let ((inp '( + (a 1) + ;; (((a . 1))) ;This is an array of TOML table + ))) + (dolist (el inp) + (should (equal nil (tomelr--toml-table-p el)))))) + + +(provide 'tinternal)