From 2d58e0e803fb5fe397d446d58a0d83f0d35b4fc4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 30 Dec 2020 08:29:38 +0100 Subject: Add some char-table tests * test/src/chartab-tests.el (chartab-test-char-table-p) (chartab-test-char-table-subtype) (chartab-test-char-table-parent) (chartab-test-char-table-extra-slot): New tests. --- test/src/chartab-tests.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/src/chartab-tests.el b/test/src/chartab-tests.el index 4d52dc367c8..0a8d8bcdf7d 100644 --- a/test/src/chartab-tests.el +++ b/test/src/chartab-tests.el @@ -49,5 +49,25 @@ (#xe0e00 . #xe0ef6) ))) +(ert-deftest chartab-test-char-table-p () + (should (char-table-p (make-char-table 'foo))) + (should (not (char-table-p (make-hash-table))))) + +(ert-deftest chartab-test-char-table-subtype () + (should (eq (char-table-subtype (make-char-table 'foo)) 'foo))) + +(ert-deftest chartab-test-char-table-parent () + (should (eq (char-table-parent (make-char-table 'foo)) nil)) + (let ((parent (make-char-table 'foo)) + (child (make-char-table 'bar))) + (set-char-table-parent child parent) + (should (eq (char-table-parent child) parent)))) + +(ert-deftest chartab-test-char-table-extra-slot () + ;; Use any type with extra slots, e.g. 'case-table. + (let ((tbl (make-char-table 'case-table))) + (set-char-table-extra-slot tbl 1 'bar) + (char-table-extra-slot tbl 1))) + (provide 'chartab-tests) ;;; chartab-tests.el ends here -- cgit v1.2.1