[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr b4be72f240 2/3: refactor: Rename tomelr predicat
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr b4be72f240 2/3: refactor: Rename tomelr predicate functions for consistency |
Date: |
Tue, 3 May 2022 12:58:11 -0400 (EDT) |
branch: externals/tomelr
commit b4be72f240038d2db27540effcdd63e649b4df57
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
refactor: Rename tomelr predicate functions for consistency
---
test/all-tests.el | 2 +-
test/{tinternal.el => tpredicates.el} | 21 +++++++++++----------
tomelr.el | 16 ++++++++--------
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/test/all-tests.el b/test/all-tests.el
index a100e46ba7..1503d11c53 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -22,8 +22,8 @@
(setq load-prefer-newer t)
(require 'tjson-utils)
-(require 'tinternal)
+(require 'tpredicates)
(require 'tkey)
(require 'tscalar)
(require 'tstring)
diff --git a/test/tinternal.el b/test/tpredicates.el
similarity index 88%
rename from test/tinternal.el
rename to test/tpredicates.el
index 2a51a0b6b2..05b66f149c 100644
--- a/test/tinternal.el
+++ b/test/tpredicates.el
@@ -19,11 +19,12 @@
;;; Commentary:
-;; Tests for some internal functions.
+;; Tests for some tomelr predicate functions.
;;; Code:
(require 'tomelr)
+;;;; tomelr-alist-p
(ert-deftest test-internal-tomelr-alist-p-true ()
(let ((inp '(
((a . 1))
@@ -54,7 +55,7 @@
(dolist (el inp)
(should (equal nil (tomelr-alist-p el))))))
-;;;; tomelr--toml-table-p
+;;;; tomelr-toml-table-p
(ert-deftest test-internal-toml-table-true ()
(let ((inp '(
((a . 1))
@@ -71,7 +72,7 @@
((c . 300)))))
)))
(dolist (el inp)
- (should (equal t (tomelr--toml-table-p el))))))
+ (should (equal t (tomelr-toml-table-p el))))))
(ert-deftest test-internal-toml-table-false ()
(let ((inp '(
@@ -81,9 +82,9 @@
(((a . 1))) ;This is an array of TOML table
)))
(dolist (el inp)
- (should (equal nil (tomelr--toml-table-p el))))))
+ (should (equal nil (tomelr-toml-table-p el))))))
-;;;; tomelr--toml-table-array-p
+;;;; tomelr-toml-table-array-p
(ert-deftest test-internal-tta-alist-true ()
(let ((inp '(
;; TTA with 1 table of 1 key-val pair
@@ -95,7 +96,7 @@
(((a . (((b . 2))))))
)))
(dolist (el inp)
- (should (equal t (tomelr--toml-table-array-p el))))))
+ (should (equal t (tomelr-toml-table-array-p el))))))
(ert-deftest test-internal-tta-plist-vector-notation-true ()
(let ((inp '(
@@ -106,7 +107,7 @@
(:a 200 :b "bar")]
)))
(dolist (el inp)
- (should (equal t (tomelr--toml-table-array-p el))))))
+ (should (equal t (tomelr-toml-table-array-p el))))))
(ert-deftest test-internal-tta-plist-list-notation-true ()
(let ((inp '(
@@ -117,14 +118,14 @@
(:a 100 :b 200))
)))
(dolist (el inp)
- (should (equal t (tomelr--toml-table-array-p el))))))
+ (should (equal t (tomelr-toml-table-array-p el))))))
(ert-deftest test-internal-tta-false ()
(let ((inp '(
((a . 1)) ;This is a TOML table
)))
(dolist (el inp)
- (should (equal nil (tomelr--toml-table-array-p el))))))
+ (should (equal nil (tomelr-toml-table-array-p el))))))
-(provide 'tinternal)
+(provide 'tpredicates)
diff --git a/tomelr.el b/tomelr.el
index d4d32c9b25..39435fc27d 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -333,7 +333,7 @@ Signal `tomelr-key-format' if it cannot be encoded as a
string."
;; (message "[tomelr-alist-p DBG] out 2 list = %S, is alist? %S" list (null
list))
(null list))
-(defun tomelr--toml-table-p (object)
+(defun tomelr-toml-table-p (object)
"Return non-nil if OBJECT can represent a TOML Table.
Recognize both alist and plist format maps as TOML Tables.
@@ -348,8 +348,8 @@ Examples:
(defun tomelr--print-pair (key val)
"Insert TOML representation of KEY - VAL pair at point."
(let ((key-type (cond
- ((tomelr--toml-table-p val) 'table-key)
- ((tomelr--toml-table-array-p val) 'table-array-key)
+ ((tomelr-toml-table-p val) 'table-key)
+ ((tomelr-toml-table-array-p val) 'table-array-key)
(t 'normal-key))))
;; (message "[tomelr--print-pair DBG] key = %S, val = %S, key-type = %S"
;; key val key-type)
@@ -372,14 +372,14 @@ This works for any MAP satisfying `mapp'."
;;;; Lists (including alists and plists)
(defun tomelr--print-list (list)
"Insert a TOML representation of LIST at point."
- (cond ((tomelr--toml-table-p list)
+ (cond ((tomelr-toml-table-p list)
(tomelr--print-map list))
((listp list)
(tomelr--print-array list))
((signal 'tomelr-error (list list)))))
;;;; Arrays
-(defun tomelr--toml-table-array-p (object)
+(defun tomelr-toml-table-array-p (object)
"Return non-nil if OBJECT can represent a TOML Table Array.
Definition of a TOML Table Array (TTA):
@@ -389,7 +389,7 @@ Definition of a TOML Table Array (TTA):
(when (or (listp object)
(vectorp object))
(seq-every-p
- (lambda (elem) (tomelr--toml-table-p elem))
+ (lambda (elem) (tomelr-toml-table-p elem))
object)))
(defun tomelr--print-tta-key ()
@@ -408,9 +408,9 @@ Definition of a TOML Table Array (TTA):
(defun tomelr--print-array (array)
"Insert a TOML representation of ARRAY at point."
;; (message "[tomelr--print-array DBG] array = %S, TTA = %S"
- ;; array (tomelr--toml-table-array-p array))
+ ;; array (tomelr-toml-table-array-p array))
(cond
- ((tomelr--toml-table-array-p array)
+ ((tomelr-toml-table-array-p array)
(unless (= 0 (length array))
(let ((first t))
(mapc (lambda (elt)