From 29235c8bcb3f0e5d24287935a091755a4a5861c9 Mon Sep 17 00:00:00 2001 From: Yikai Zhao Date: Wed, 3 Jan 2024 23:50:52 +0800 Subject: [PATCH] test: implement plistp --- tests/benchmark_and_compare.template.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/benchmark_and_compare.template.el b/tests/benchmark_and_compare.template.el index 909d39c..088810a 100644 --- a/tests/benchmark_and_compare.template.el +++ b/tests/benchmark_and_compare.template.el @@ -23,6 +23,11 @@ (and (listp x) (-all (lambda (e) (and (consp e) (symbolp (car e)))) x))) +(defun -plistp (x) + (and (listp x) + x + (keywordp (car x)))) + (defun -sort-alist (x) (sort x (lambda (a b) (string< (symbol-name (car a)) (symbol-name (car b)))))) @@ -60,8 +65,8 @@ (equal (length a) (length b)) (-check-equal-sorted-alist (-sort-alist a) (-sort-alist b)))) - ((pred plistp) - (and (plistp b) + ((pred -plistp) ;; plistp is not available before emacs29 + (and (-plistp b) (equal (length a) (length b)) (-check-equal-sorted-alist (-plist-to-sorted-alist a) (-plist-to-sorted-alist b))))