summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-06-12 23:15:57 +0400
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-06-12 23:15:57 +0400
commitf55540ea2967ee3feefd84e56ed426d9a84a4f44 (patch)
treeb279de446a4e4bf4dd6ff41a753a90c28e5802b0 /tests
parenttests/common.scm (start-session-loop): New procedure (diff)
downloadguile-ssh-f55540ea2967ee3feefd84e56ed426d9a84a4f44.tar.gz
tests/common.scm (test-error-with-log): New macro
* tests/common.scm (test-error-with-log): New macro. * tests/dist.scm ("rrepl-skip-to-prompt, invalid input"): Use it.
Diffstat (limited to 'tests')
-rw-r--r--tests/common.scm14
-rw-r--r--tests/dist.scm12
2 files changed, 18 insertions, 8 deletions
diff --git a/tests/common.scm b/tests/common.scm
index 30b0c68..9a476aa 100644
--- a/tests/common.scm
+++ b/tests/common.scm
@@ -41,6 +41,7 @@
;; Procedures
get-unused-port
test-assert-with-log
+ test-error-with-log
start-session-loop
make-session-for-test
make-server-for-test
@@ -88,6 +89,19 @@
(set-log-userdata! name)
body ...)))))
+(define-syntax test-error-with-log
+ (syntax-rules ()
+ ((_ name error body ...)
+ (test-assert-with-log name
+ (catch error
+ (lambda () body ... #f)
+ (const #t))))
+ ((_ name body ...)
+ (test-assert-with-log name
+ (catch #t
+ (lambda () body ... #f)
+ (const #t))))))
+
(define (start-session-loop session body)
(let session-loop ((msg (server-message-get session)))
(when (and msg (not (eof-object? msg)))
diff --git a/tests/dist.scm b/tests/dist.scm
index 7524a94..ed17d74 100644
--- a/tests/dist.scm
+++ b/tests/dist.scm
@@ -154,14 +154,10 @@
(rrepl-skip-to-prompt port)))
#t))
-(test-assert "rrepl-skip-to-prompt, invalid input"
- (catch 'node-error
- (lambda ()
- (call-with-input-string "invalid input"
- (lambda (port)
- (rrepl-skip-to-prompt port)))
- #f)
- (const #t)))
+(test-error-with-log "rrepl-skip-to-prompt, invalid input 2" 'node-error
+ (call-with-input-string "invalid input"
+ (lambda (port)
+ (rrepl-skip-to-prompt port))))
;;; Distributed forms.