Added tests for parameterizations and thread cells.

This commit is contained in:
Eric Dobson 2011-06-20 15:59:24 -04:00 committed by Sam Tobin-Hochstadt
parent f5a7e73be8
commit c2a473cba2
3 changed files with 37 additions and 3 deletions

View File

@ -1,5 +1,16 @@
#lang typed-scheme
#lang typed/racket
(parameterize ([current-directory ".."])
(current-directory)
(current-directory ".."))
(: old-param Parameterization)
(define old-param (current-parameterization))
(current-directory "..")
(call-with-parameterization old-param (lambda () (current-directory)))
(parameterization? old-param)

View File

@ -1,4 +1,4 @@
#lang typed/scheme
#lang typed/racket
(: chan (Channelof Symbol))
(define chan (make-channel))
@ -48,3 +48,26 @@
(channel-put c2 (cons c3 'b))
(let: ((c4 : JumpingChannel (make-channel)))
(channel-put c3 (cons c4 'c)))))
(: tc (ThreadCellof Integer))
(define tc (make-thread-cell 0))
(thread-cell-set! tc 1)
(thread-wait (thread (lambda ()
(displayln (thread-cell-ref tc))
(thread-cell-set! tc 2)
(displayln (thread-cell-ref tc)))))
(thread-cell-ref tc)
(define blocked-thread
(thread (lambda ()
(channel-get ((inst make-channel 'unused))))))
(thread-suspend blocked-thread)
(kill-thread blocked-thread)

View File

@ -214,7 +214,7 @@
(define -Custodian (make-Base 'Custodian #'custodian? custodian? #'Custodian))
(define -Parameterization (make-Base 'Parameterization #'parameterization? parameterization? #'Parameterization))
(define -Parameterization (make-Base 'Parameterization #'parameterization? parameterization? #'-Parameterization))
(define -Inspector (make-Base 'Inspector #'inspector inspector? #'-Inspector))