Skip to content

Commit

Permalink
test: Test tomelr--toml-table-p
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Apr 30, 2022
1 parent 38160ef commit 0d4674f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/all-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

(setq load-prefer-newer t)

(require 'tinternal)

(require 'tscalar)
(require 'tnil)
(require 'tarray)
Expand Down
47 changes: 47 additions & 0 deletions test/tinternal.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
;; -*- lexical-binding: t; -*-

;; Authors: Kaushal Modi <kaushal.modi@gmail.com>

;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; Tests for some internal functions.

;;; 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)

0 comments on commit 0d4674f

Please sign in to comment.