diff options
author | Ludovic Courtes <ludovic.courtes@laas.fr> | 2006-06-25 22:43:20 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-10 20:28:03 +0200 |
commit | e13f1cbdffa4f333d9866d1b22cd2c9a3b17b3bd (patch) | |
tree | ee0d43d58b8fc6f3f8c961b8e131376c97b47589 /test-suite/tests/guardians.test | |
parent | 9778b58a19aa8eed5d795f8785fd61a41849560c (diff) | |
download | guile-e13f1cbdffa4f333d9866d1b22cd2c9a3b17b3bd.tar.gz |
Fixed `guardians.test' so that it does not use symbols.
* test-suite/tests/guardians.test: Use strings instead of symbols for
`g3-garbage' et al.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-42
Diffstat (limited to 'test-suite/tests/guardians.test')
-rw-r--r-- | test-suite/tests/guardians.test | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test-suite/tests/guardians.test b/test-suite/tests/guardians.test index 15f67e609..e6a4203a2 100644 --- a/test-suite/tests/guardians.test +++ b/test-suite/tests/guardians.test @@ -41,11 +41,18 @@ (gc) ;;; Who guards the guardian? + +;;; Note: We use strings rather than symbols because symbols are usually +;;; ``interned'', i.e., kept in a weakly-keyed hash table, thus making them +;;; inappropriate for the tests below. Furthermore, we use `string-copy' in +;;; order to make sure that no string is kept around in the interpreter +;;; unwillingly (e.g., in the source-property weak hash table). + (gc) (define g2 (make-guardian)) -(g2 (list 'g2-garbage)) +(g2 (list (string-copy "g2-garbage"))) (define g3 (make-guardian)) -(g3 (list 'g3-garbage)) +(g3 (list (string-copy "g3-garbage"))) (g3 g2) (pass-if "g2-garbage not collected yet" (equal? (g2) #f)) (pass-if "g3-garbage not collected yet" (equal? (g3) #f)) @@ -59,15 +66,18 @@ (if saved (begin (cond - ((equal? saved '(g3-garbage)) (set! seen-g3-garbage #t)) + ((equal? saved (list (string-copy "g3-garbage"))) + (set! seen-g3-garbage #t)) ((procedure? saved) (set! seen-g2 saved)) - (else (pk saved) (set! seen-something-else #t))) + (else (pk 'junk saved) (set! seen-something-else #t))) (loop))))) (pass-if "g3-garbage saved" (or seen-g3-garbage (throw 'unresolved))) (pass-if "g2-saved" (or (procedure? seen-g2) (throw 'unresolved))) (pass-if "nothing else saved" (not seen-something-else)) (pass-if "g2-garbage saved" (or (and (procedure? seen-g2) - (equal? (seen-g2) '(g2-garbage))) + (equal? (seen-g2) + (list (string-copy + "g2-garbage")))) (throw 'unresolved)))) (with-test-prefix "standard guardian functionality" |