summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-07-04 03:00:57 +0400
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-07-04 03:00:57 +0400
commit5f3a7a9bd4af2cb963408869b88e09ef5ec41055 (patch)
treea2fae4286dbf186330689d3de66034e064b2f42f /tests
parenttests/tunnel.scm (call-with-connected-session/tunnel): New proc (diff)
downloadguile-ssh-5f3a7a9bd4af2cb963408869b88e09ef5ec41055.tar.gz
tests/tunnel.scm: Use 'test-equal-with-log'
* tests/tunnel.scm: Use 'test-equal-with-log' where it is possible.
Diffstat (limited to 'tests')
-rw-r--r--tests/tunnel.scm26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/tunnel.scm b/tests/tunnel.scm
index ac158fa..1f60761 100644
--- a/tests/tunnel.scm
+++ b/tests/tunnel.scm
@@ -37,6 +37,8 @@
;;;
+(define %test-string "hello scheme world")
+
(define (call-with-connected-session/tunnel proc)
(call-with-connected-session
(lambda (session)
@@ -56,26 +58,24 @@
(else => (cut error "Could not open forward" <>)))))
-(test-assert-with-log "port forwarding, direct"
+(test-equal-with-log "port forwarding, direct"
+ %test-string
(run-client-test
-
;; server
(lambda (server)
(start-server/dt-test server
(lambda (channel)
(write-line (read-line channel) channel))))
-
;; client
(lambda ()
(call-with-connected-session/tunnel
(lambda (session)
- (let ((channel (make-channel/pf-test session))
- (str "hello world"))
- (write-line str channel)
+ (let ((channel (make-channel/pf-test session)))
+ (write-line %test-string channel)
(while (not (char-ready? channel)))
(let ((line (read-line channel)))
(close channel)
- (string=? str line))))))))
+ line)))))))
;; Create a tunnel, check the result.
(test-assert-with-log "make-tunnel"
@@ -138,7 +138,8 @@
;; o | | Check the result.
;; | | |
;;
-(test-assert-with-log "call-with-ssh-forward"
+(test-equal-with-log "call-with-ssh-forward"
+ %test-string
(run-client-test/separate-process
;; Server
(lambda (server)
@@ -154,16 +155,15 @@
(remote-host "www.example.org")
(tunnel (make-tunnel session
#:port local-port
- #:host remote-host))
- (str "hello world"))
+ #:host remote-host)))
(call-with-ssh-forward tunnel
(lambda (sock)
- (write-line str sock)
+ (write-line %test-string sock)
(while (not (char-ready? sock)))
(read-line sock)))))))
- ;; Predicate
+ ;; Handle the result.
(lambda (result)
- (string=? result "hello world"))))
+ result)))
(test-assert-with-log "channel-{listen,cancel}-forward"