diff tests/automated/lisp-tests.el @ 5700:37479d841681

Fix subsetp based on patch by Benson and Steven Mitchell. Add appropriate short-circuits for null set arguments. Add tests (mostly from Steven Mitchell) to test suite.
author Stephen J. Turnbull <stephen@xemacs.org>
date Mon, 24 Dec 2012 14:12:51 +0900
parents 289cf21be887
children 3192994c49ca
line wrap: on
line diff
--- a/tests/automated/lisp-tests.el	Mon Dec 24 04:16:31 2012 +0900
+++ b/tests/automated/lisp-tests.el	Mon Dec 24 14:12:51 2012 +0900
@@ -2435,6 +2435,23 @@
 	       (gethash hashed-bignum hashing))
 	      "checking hashing works correctly with #'eql tests and bignums"))))
 
+;; #'subsetp tests.
+;; Return non-nil if every element of LIST1 also appears in LIST2.
+;; A couple of non-nondegenerate false cases.
+(Assert (not (subsetp (list ?a ?b) (list ?c ?d))))
+(Assert (not (subsetp (list ?a ?b) (list ?b ?c ?d))))
+;; Next five thanks to Steven and Benson Mitchell on XEmacs Beta
+;; <50D16FF7.4090708@bnin.net>.
+;; Two non-degenerate true cases.
+(Assert (subsetp (list ?a) (list ?a ?b ?c ?d)))
+(Assert (subsetp (list ?a ?b) (list ?a ?b ?c ?d)))
+;; The three degenerate cases involving nil.
+(Assert (not (subsetp (list ?a) nil)))
+(Assert (subsetp nil (list ?a ?b ?c ?d)))
+(Assert (subsetp nil nil))
+;; #### We should also test the keywords.
+;; #### We should also test the error conditions.
+
 ;; 
 (when (decode-char 'ucs #x0192)
   (Check-Error