diff --git a/module/ice-9/sports.scm b/module/ice-9/sports.scm index 2ee97340b..ce782d856 100644 --- a/module/ice-9/sports.scm +++ b/module/ice-9/sports.scm @@ -56,6 +56,9 @@ read-char) #:export (lookahead-u8 get-u8 + %read-line + read-line + read-delimited current-read-waiter current-write-waiter install-sports! @@ -524,21 +527,23 @@ (define saved-port-bindings #f) (define port-bindings '(((guile) read-char peek-char) - ((ice-9 binary-ports) get-u8 lookahead-u8))) + ((ice-9 binary-ports) get-u8 lookahead-u8) + ((ice-9 rdelim) %read-line read-line read-delimited))) (define (install-sports!) (unless saved-port-bindings (set! saved-port-bindings (make-hash-table)) - (for-each - (match-lambda - ((mod . syms) - (let ((mod (resolve-module mod))) - (for-each (lambda (sym) - (hashq-set! saved-port-bindings sym - (module-ref mod sym)) - (module-set! mod sym - (module-ref (current-module) sym))) - syms)))) - port-bindings))) + (let ((sports (resolve-module '(ice-9 sports)))) + (for-each + (match-lambda + ((mod . syms) + (let ((mod (resolve-module mod))) + (for-each (lambda (sym) + (hashq-set! saved-port-bindings sym + (module-ref mod sym)) + (module-set! mod sym + (module-ref sports sym))) + syms)))) + port-bindings)))) (define (uninstall-sports!) (when saved-port-bindings diff --git a/test-suite/tests/sports.test b/test-suite/tests/sports.test index 6eb422ef5..6707f562a 100644 --- a/test-suite/tests/sports.test +++ b/test-suite/tests/sports.test @@ -17,7 +17,7 @@ ;;;; . (define-module (test-suite test-ports) - #:use-module (ice-9 sports)) + #:use-module ((ice-9 sports) #:select (install-sports! uninstall-sports!))) ;; Include tests from ports.test. @@ -49,4 +49,9 @@ #`((include-one #,exp) . #,(lp)))))))) #:guess-encoding #t))))) +(install-sports!) + (include-tests "tests/ports.test") +(include-tests "tests/rdelim.test") + +(uninstall-sports!)