[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector 8b000e4e4e 15/39: tree-inspector: tests
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector 8b000e4e4e 15/39: tree-inspector: tests |
Date: |
Sat, 10 Sep 2022 17:57:47 -0400 (EDT) |
branch: externals/inspector
commit 8b000e4e4ee0867c875be87f2869aa30e1a82df2
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
tree-inspector: tests
---
tree-inspector-tests.el | 102 ++++++++++++++++++++----------------------------
tree-inspector.el | 19 +++++++++
2 files changed, 61 insertions(+), 60 deletions(-)
diff --git a/tree-inspector-tests.el b/tree-inspector-tests.el
index a258f32f08..65cb0c3e27 100644
--- a/tree-inspector-tests.el
+++ b/tree-inspector-tests.el
@@ -57,6 +57,7 @@
(defun tree-inspector-tests-run ()
"Run tree-inspector tests."
+ (interactive)
(ert "tree-inspector-tests.*"))
(ert-deftest tree-inspector-tests--inspect-integer-test ()
@@ -73,75 +74,56 @@
;;(should (cl-search "float" buffer-string))
))
-(ert-deftest inspector-tests--inspect-character-test ()
- (inspector-inspect ?a)
- (let ((buffer-string (buffer-string)))
- (should (cl-search "character" buffer-string))
- (should (cl-search "97" buffer-string))
- (inspector-quit)))
+(ert-deftest tree-inspector-tests--inspect-character-test ()
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string ?a)
+ (should (cl-search "97" buffer-string))))
-(ert-deftest inspector-tests--inspect-symbol-test ()
- (inspector-inspect 'abcd)
- (let ((buffer-string (buffer-string)))
- (should (cl-search "abcd" buffer-string))
- (should (cl-search "symbol" buffer-string))
- (inspector-quit))
+(ert-deftest tree-inspector-tests--inspect-symbol-test ()
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string 'abcd)
+ (should (cl-search "abcd" buffer-string)))
- (inspector-inspect :abcd)
- (let ((buffer-string (buffer-string)))
- (should (cl-search "abcd" buffer-string))
- (should (cl-search "symbol" buffer-string))
- (inspector-quit)))
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string :abcd)
+ (should (cl-search "abcd" buffer-string))))
-(ert-deftest inspector-tests--inspect-list-test ()
- (inspector-inspect '(1 2 3))
- (let ((buffer-string (buffer-string)))
- (should (cl-search "list" buffer-string))
- (should (cl-search "1" buffer-string))
+(ert-deftest tree-inspector-tests--inspect-list-test ()
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string '(1 2 3))
+ (should (cl-search "1" buffer-string))
(should (cl-search "2" buffer-string))
- (should (cl-search "3" buffer-string))
- (inspector-quit)))
+ (should (cl-search "3" buffer-string))))
(ert-deftest inspector-tests--inspect-vector-test ()
- (inspector-inspect [1 "two" (three)])
- (let ((buffer-string (buffer-string)))
- (should (cl-search "vector" buffer-string))
- (should (cl-search "1" buffer-string))
- (should (cl-search "two" buffer-string))
- (should (cl-search "three" buffer-string))
- (inspector-quit)))
-
-;; Long lists are to be sliced:
-(ert-deftest inspector-tests--inspect-long-list-test ()
- (inspector-inspect (cl-loop for i from 1 to 3000 collect i))
- (let ((buffer-string (buffer-string)))
- (should (cl-search "more" buffer-string))
- (should (< (count-lines (point-min) (point-max)) 120)))
- (inspector-quit))
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string [1 "two" (three)])
+ (should (cl-search "1" buffer-string))
+ (should (cl-search "two" buffer-string))
+ (should (cl-search "three" buffer-string))))
;; Char tables
;;
https://www.gnu.org/software/emacs/manual/html_node/elisp/Char_002dTable-Type.html
-(ert-deftest inspector-tests--inspect-char-table-test ()
- (inspector-inspect ascii-case-table)
- (let ((buffer-string (buffer-string)))
- (should (cl-search "char-table" buffer-string))
- (inspector-quit))
-
- (inspector-inspect (make-display-table))
- (let ((buffer-string (buffer-string)))
- (should (cl-search "char-table" buffer-string))
- (inspector-quit))
-
- (inspector-inspect (standard-syntax-table))
- (let ((buffer-string (buffer-string)))
- (should (cl-search "char-table" buffer-string))
- (inspector-quit)))
-
-(ert-deftest inspector-tests--inspect-bool-vector-test ()
- (inspector-inspect (make-category-set "al"))
- (let ((buffer-string (buffer-string)))
- (should (cl-search "bool-vector" buffer-string))
- (inspector-quit)))
+;; (ert-deftest inspector-tests--inspect-char-table-test ()
+;; (tree-inspector-inspect ascii-case-table)
+;; (let ((buffer-string (buffer-string)))
+;; (should (cl-search "char-table" buffer-string))
+;; (inspector-quit))
+
+;; (inspector-inspect (make-display-table))
+;; (let ((buffer-string (buffer-string)))
+;; (should (cl-search "char-table" buffer-string))
+;; (inspector-quit))
+
+;; (inspector-inspect (standard-syntax-table))
+;; (let ((buffer-string (buffer-string)))
+;; (should (cl-search "char-table" buffer-string))
+;; (inspector-quit)))
+
+;; (ert-deftest tree-inspector-tests--inspect-bool-vector-test ()
+;; (tree-inspector-tests--with-tree-inspector-contents
+;; (buffer-string (make-category-set "al"))
+;; (should (cl-search "nil" buffer-string))))
(ert-deftest inspector-tests--inspect-nil-test ()
(inspector-inspect nil)
diff --git a/tree-inspector.el b/tree-inspector.el
index 96b781771c..0f959c5865 100644
--- a/tree-inspector.el
+++ b/tree-inspector.el
@@ -167,6 +167,10 @@ in a format understood by `kbd'. Commands a names of Lisp
functions."
(cl-defgeneric tree-inspector--node-children (node)
(:documentation "Return the NODE children treeview nodes."))
+(cl-defmethod tree-inspector--node-children ((object t))
+ "Objects have no children by default."
+ nil)
+
(cl-defmethod tree-inspector--node-children ((object cons))
(cond
;; alists
@@ -269,6 +273,21 @@ in a format understood by `kbd'. Commands a names of Lisp
functions."
node))
(t (error "Implement inspector for: %s" object))))
+(cl-defmethod tree-inspector--make-node ((object bool-vector))
+ (let ((node (treeview-new-node)))
+ (treeview-set-node-name
+ node (tree-inspector--print-object object))
+ (treeview-set-node-prop node 'object object)
+ (treeview-set-node-children
+ node
+ (cl-map 'list
+ (lambda (item)
+ (let ((child (tree-inspector--make-node item)))
+ (treeview-set-node-parent child node)
+ child))
+ object))
+ node))
+
(cl-defmethod tree-inspector--make-node ((object vector))
(let ((node (treeview-new-node)))
(treeview-set-node-name
- [elpa] externals/inspector updated (f04c60a5d3 -> 0b213e931c), ELPA Syncer, 2022/09/10
- [elpa] externals/inspector e2e56201a0 01/39: Starting a tree-inspector with treeview, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 06eb60bcff 03/39: tree-inspector: indentation, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 56579dae8a 05/39: tree-inspector: hash-table inspector, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 838b08706a 02/39: tree-inspector work, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector faf590dded 06/39: tree-inspector: alist inspector, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 068b754a0a 07/39: tree-inspector: vectors, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector d43bb09ae9 11/39: tree-inspector: housekeeping, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 4066d7b441 13/39: Starting some tree-inspector tests, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 8b000e4e4e 15/39: tree-inspector: tests,
ELPA Syncer <=
- [elpa] externals/inspector 130c43c6b6 19/39: tree-inspector: records, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 394fb22811 09/39: ..., ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 98d3d56723 10/39: tree-inspector: provide, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 236ef196a0 24/39: tree-inspector: fixes, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector fc9712651c 36/39: More complete package commentary, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 5828d49207 21/39: tree-inspector: inspect-last-sexp, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 1f1469ec9d 22/39: tree-inspector: buffers, windows, frames, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 49586fc18b 23/39: tree-inspector: buffers, windows, overlays, frames, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 1ea746c8e0 27/39: tree-inspector: better window inspector, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 019019c3b5 30/39: tree-inspector: housekeeping, ELPA Syncer, 2022/09/10