diff tests/automated/weak-tests.el @ 1773:aa0db78e67c4

[xemacs-hg @ 2003-11-01 14:54:53 by kaltenbach] Bugfix in USE_KKCC mode processing weak data structures 2003-11-01 Markus Kaltenbach <makalten@informatik.uni-tuebingen.de> * src/alloc.c (garbage_collect_1):fix bug * automated/weak-tests.el:added test to track it down
author kaltenbach
date Sat, 01 Nov 2003 14:55:00 +0000
parents 90502933fb98
children cef5f57bb9e2
line wrap: on
line diff
--- a/tests/automated/weak-tests.el	Fri Oct 31 22:51:31 2003 +0000
+++ b/tests/automated/weak-tests.el	Sat Nov 01 14:55:00 2003 +0000
@@ -222,3 +222,26 @@
   (Assert (equal (weak-list-list weaklist4) testlist)))
 
 (garbage-collect)
+
+;; test the intended functionality of the fixpoint iteration used for marking
+;; weak data structures like the ephermerons. Basically this tests gc_internals
+;; to work properly but it also ensures the ephemerons behave according to the
+;; specification
+
+(let* ((inner_cons (cons 1 2))
+       (weak1 (make-ephemeron inner_cons
+			      (make-ephemeron inner_cons
+					      (cons 1 2)
+					      '(lambda (v) t))
+			      '(lambda (v) t))))
+  (Assert (ephemeron-ref (ephemeron-ref weak1)))
+  (garbage-collect)
+  ;; assure the inner ephis are still there
+  (Assert (ephemeron-ref (ephemeron-ref weak1)))
+  ;; delete the key reference and force cleaning up the garbage
+  (setq inner_cons (cons 3 4))
+  (garbage-collect)
+  (Assert (not (ephemeron-ref weak1)))
+)
+
+(garbage-collect)