annotate tests/automated/weak-tests.el @ 1395:607ad5a2ae95

[xemacs-hg @ 2003-03-31 08:13:20 by mta] frame-msw.c (mswindows_set_frame_size): Call change_frame_size.
author mta
date Mon, 31 Mar 2003 08:13:20 +0000
parents 7532e276a83a
children f062c28f4a11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
1 ;; Copyright (C) 1998 Free Software Foundation, Inc.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
2
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
3 ;; Author: Mike Sperber <mike@xemacs.org>
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
4 ;; Maintainer: Mike Sperber <mike@xemacs.org>
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
5 ;; Created: 2002
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
6 ;; Keywords: tests, database
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
7
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
8 ;; This file is part of XEmacs.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
9
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
13 ;; any later version.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
14
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
18 ;; General Public License for more details.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
19
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
23 ;; 02111-1307, USA.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
24
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
26
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
27 ;;; Commentary:
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
28
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
29 ;;; Test implementation of weak boxes and ephemerons
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
30 ;;; See test-harness.el
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
31
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
32 (condition-case err
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
33 (require 'test-harness)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
34 (file-error
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
35 (when (and (boundp 'load-file-name) (stringp load-file-name))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
36 (push (file-name-directory load-file-name) load-path)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
37 (require 'test-harness))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
38
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
39 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
40 (let ((w (make-weak-box (cons 2 3))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
41 (Assert (equal (cons 2 3) (weak-box-ref w)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
42 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
43 (Assert (not (weak-box-ref w))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
44
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
45 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
46
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
47 (let* ((p (cons 3 4))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
48 (finalized-p nil)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
49 (eph1 (make-ephemeron (cons 1 2) p
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
50 '(lambda (value)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
51 (setq finalized-p t))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
52 (eph2 (make-ephemeron p p)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
53 (Assert (eq p (ephemeron-ref (make-ephemeron (cons 1 2) p))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
54 (Assert (ephemeron-p (make-ephemeron (cons 1 2) p)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
55
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
56 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
57 (garbage-collect) ; ensure the post-gc hook runs
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
58
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
59 (Assert finalized-p)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
60 (Assert (not (ephemeron-ref eph1)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
61
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
62 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
63
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
64 (Assert (eq p (ephemeron-ref eph2))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
65