;;;; error-utils-test.scm -*- Scheme -*- ;;;; Kon Lovett, Jul '18 (import test) (test-begin "Error Utils") ;;; (import (chicken port) error-utils) (test-group "errorf & errorf-print" (test "\nError: msg\n" (call-with-output-string (lambda (port) (errorf-print "msg" port)))) (test-error (errorf "msg")) (test "\nError: loc\n" (call-with-output-string (lambda (port) (errorf-print 'loc port)))) (test-error (errorf 'loc)) (test "\nError: (loc) msg\n" (call-with-output-string (lambda (port) (errorf-print 'loc "msg" port)))) (test-error (errorf 'loc "msg")) (test "\nError: msg hello \"hello\"\n" (call-with-output-string (lambda (port) (errorf-print "msg ~A ~S" "hello" "hello" port)))) (test-error (errorf "msg ~A ~S" "hello" "hello")) (test "\nError: (loc) msg hello \"hello\"\n" (call-with-output-string (lambda (port) (errorf-print 'loc "msg ~A ~S" "hello" "hello" port)))) (test-error (errorf 'loc "msg ~A ~S" "hello" "hello")) ) (test-group "error-print" (test "\nError: (loc) msg\narg\n1\n" (call-with-output-string (lambda (port) (error-print 'loc "msg" 'arg 1 port)))) (test-error (error 'loc "msg" 'arg 1)) ) ;;; (test-end "Error Utils") (test-exit)