#lang scheme/base
(require (file "log.ss")
(file "test-base.ss"))
(define test-receiver
(make-log-receiver (current-application-logger) 'debug))
(define-check (check-message level-string timestamp expected)
(match-define (vector level message continuation-marks)
(sync test-receiver))
(check-equal? message
(format "~a,~a,~a"
level-string
(format-log-timestamp timestamp)
expected)))
(define-shortcut (test-message level-string timestamp expected)
(check-message level-string timestamp expected))
(define log-tests
(test-suite "log.ss"
(test-message "log-fatal*"
"F"
(log-fatal* "a" "b" "c" 1 2 3 #t #f)
"\"a\",\"b\",\"c\",1,2,3,#t,#f")
(test-message "log-error*"
"E"
(log-error* "a" "b" "c" 1 2 3 #t #f)
"\"a\",\"b\",\"c\",1,2,3,#t,#f")
(test-message "log-warning*"
"W"
(log-warning* "a" "b" "c" 1 2 3 #t #f)
"\"a\",\"b\",\"c\",1,2,3,#t,#f")
(test-message "log-info*"
"I"
(log-info* "a" "b" "c" 1 2 3 #t #f)
"\"a\",\"b\",\"c\",1,2,3,#t,#f")
(test-message "log-debug*"
"D"
(log-debug* "a" "b" "c" 1 2 3 #t #f)
"\"a\",\"b\",\"c\",1,2,3,#t,#f")))
(provide log-tests)