From a5706bb45198a02b29c52e5ff254459ddfb315c1 Mon Sep 17 00:00:00 2001 From: Zhu Zihao Date: Sat, 27 Jul 2019 21:26:48 +0800 Subject: [PATCH] More test to cover cases on different `-compare-fn` --- dev/examples.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dev/examples.el b/dev/examples.el index ff7a92d..7142370 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -692,7 +692,19 @@ new list." (defexamples -distinct (-distinct '()) => '() - (-distinct '(1 2 2 4)) => '(1 2 4))) + (-distinct '(1 2 2 4)) => '(1 2 4) + (-distinct '(t t t)) => '(t) + (-distinct '(nil nil nil)) => '(nil) + (let ((-compare-fn nil)) + (-distinct '((1) (2) (1) (1)))) => '((1) (2)) + (let ((-compare-fn #'eq)) + (-distinct '((1) (2) (1) (1)))) => '((1) (2) (1) (1)) + (let ((-compare-fn #'eq)) + (-distinct '(:a :b :a :a))) => '(:a :b) + (let ((-compare-fn #'eql)) + (-distinct '(2.1 3.1 2.1 2.1))) => '(2.1 3.1) + (let ((-compare-fn #'string=)) + (-distinct '(dash "dash" "ash" "cash" "bash"))) => '(dash "ash" "cash" "bash"))) (def-example-group "Other list operations" "Other list functions not fit to be classified elsewhere."