diff options
author | Andy Wingo <wingo@pobox.com> | 2016-05-22 20:39:03 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-05-22 20:40:54 +0200 |
commit | 2c95a2102711c990d81bd8908506cd35b9b71022 (patch) | |
tree | f1224dfc371625a33f01c60e30401d554938e7be | |
parent | 2badbd06f695127039e8772f56e9ba44ec875896 (diff) | |
download | guile-2c95a2102711c990d81bd8908506cd35b9b71022.tar.gz |
More thorough ice-9 sports testing
* module/ice-9/sports.scm: Export read-line, %read-line, and
read-delimited. Add these latest three to install-sports!, and fix
install-sports! if the current module isn't (ice-9 sports).
* test-suite/tests/sports.test: Use install-sports! instead of lexical
bindings, to allow us to nicely frob bindings in rdelim. Include
rdelim tests.
-rw-r--r-- | module/ice-9/sports.scm | 29 | ||||
-rw-r--r-- | test-suite/tests/sports.test | 7 |
2 files changed, 23 insertions, 13 deletions
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 @@ ;;;; <http://www.gnu.org/licenses/>. (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!) |