[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/01: More thorough ice-9 sports testing
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/01: More thorough ice-9 sports testing |
Date: |
Sun, 22 May 2016 18:41:11 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 2c95a2102711c990d81bd8908506cd35b9b71022
Author: Andy Wingo <address@hidden>
Date: Sun May 22 20:39:03 2016 +0200
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.
---
module/ice-9/sports.scm | 29 +++++++++++++++++------------
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 2ee9734..ce782d8 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 6eb422e..6707f56 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!)