From 48209fa1c105848194c76112684745296fafaaf1 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 22 Dec 2012 16:37:18 +0900 Subject: [PATCH] Adding test for exception values stored in hash tables. --- tests/hash-tests.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hash-tests.scm b/tests/hash-tests.scm index 710f08f2..79ac5d16 100644 --- a/tests/hash-tests.scm +++ b/tests/hash-tests.scm @@ -164,6 +164,14 @@ '(("cat" . black) ("dog" . white) ("elephant" . pink)) (hash-table->alist ht))) +;; Exception values - this works because the return value from the +;; primitives is a cell, and we use the cdr opcode to retrieve the +;; cell value. Thus there is no FFI issue with storing exceptions. +(let ((ht (make-hash-table))) + (hash-table-set! ht 'boom (make-exception 'my-exn-type "boom!" '() #f #f)) + (test 'my-exn-type (exception-type (hash-table-ref ht 'boom)))) + +;; stress test (test 625 (let ((ht (make-hash-table))) (do ((i 0 (+ i 1))) ((= i 1000))