[functional tests] Remove dependency on the ThunderChez library.
I've just moved the relevant code into the functional-tests dir.
This commit is contained in:
43
functional-tests/srfi/s6/basic-string-ports.mzscheme.sls
Normal file
43
functional-tests/srfi/s6/basic-string-ports.mzscheme.sls
Normal file
@@ -0,0 +1,43 @@
|
||||
;; Copyright (c) 2009 Derick Eddington. All rights reserved.
|
||||
;; Licensed under an MIT-style license. My license is in the file
|
||||
;; named LICENSE from the original collection this file is distributed
|
||||
;; with. If this file is redistributed with some other collection, my
|
||||
;; license must also be included.
|
||||
|
||||
#!r6rs
|
||||
(library (srfi s6 basic-string-ports)
|
||||
(export
|
||||
(rename (open-string-input-port open-input-string))
|
||||
open-output-string
|
||||
get-output-string)
|
||||
(import
|
||||
(rnrs)
|
||||
(only (scheme base) make-weak-hasheq hash-ref hash-set!))
|
||||
|
||||
(define accumed-ht (make-weak-hasheq))
|
||||
|
||||
(define (open-output-string)
|
||||
(letrec ([sop
|
||||
(make-custom-textual-output-port
|
||||
"string-output-port"
|
||||
(lambda (string start count) ; write!
|
||||
(when (positive? count)
|
||||
(let ([al (hash-ref accumed-ht sop)])
|
||||
(hash-set! accumed-ht sop
|
||||
(cons (substring string start (+ start count)) al))))
|
||||
count)
|
||||
#f ; get-position TODO?
|
||||
#f ; set-position! TODO?
|
||||
#f #| closed TODO? |# )])
|
||||
(hash-set! accumed-ht sop '())
|
||||
sop))
|
||||
|
||||
(define (get-output-string sop)
|
||||
(if (output-port? sop)
|
||||
(cond [(hash-ref accumed-ht sop #f)
|
||||
=> (lambda (al) (apply string-append (reverse al)))]
|
||||
[else
|
||||
(assertion-violation 'get-output-string "not a string-output-port" sop)])
|
||||
(assertion-violation 'get-output-string "not an output-port" sop)))
|
||||
|
||||
)
|
20
functional-tests/srfi/s6/basic-string-ports.sls
Normal file
20
functional-tests/srfi/s6/basic-string-ports.sls
Normal file
@@ -0,0 +1,20 @@
|
||||
;; Copyright (c) 2009 Derick Eddington. All rights reserved.
|
||||
;; Licensed under an MIT-style license. My license is in the file
|
||||
;; named LICENSE from the original collection this file is distributed
|
||||
;; with. If this file is redistributed with some other collection, my
|
||||
;; license must also be included.
|
||||
|
||||
#!r6rs
|
||||
(library (srfi s6 basic-string-ports)
|
||||
(export
|
||||
open-input-string
|
||||
open-output-string
|
||||
get-output-string)
|
||||
(import
|
||||
(rnrs base)
|
||||
(only (rnrs io ports) open-string-input-port)
|
||||
(srfi s6 basic-string-ports compat))
|
||||
|
||||
(define (open-input-string str)
|
||||
(open-string-input-port str))
|
||||
)
|
@@ -0,0 +1,6 @@
|
||||
|
||||
(library (srfi s6 basic-string-ports compat)
|
||||
|
||||
(export open-output-string get-output-string)
|
||||
|
||||
(import (only (chezscheme) open-output-string get-output-string)))
|
Reference in New Issue
Block a user