even more tests

This commit is contained in:
Spencer Florence 2015-01-07 13:20:42 -05:00
parent 768f7c924f
commit ae6ce31966

View File

@ -49,6 +49,25 @@
'repo_token repo-token)] 'repo_token repo-token)]
[repo-token (hasheq 'service_name "cover" 'repo_token repo-token)] [repo-token (hasheq 'service_name "cover" 'repo_token repo-token)]
[else (error "No repo token or ci service detected")])) [else (error "No repo token or ci service detected")]))
(module+ test
(define-syntax (with-env stx)
(syntax-case stx ()
[(test-with-env (env ...) test ...)
#'(parameterize ([current-environment-variables
(make-environment-variables
(string->bytes/utf-8 env) ...)])
test ...)]))
(with-env ()
(check-exn void determine-build-type))
(with-env ("COVERALLS_REPO_TOKEN" "abc")
(check-equal? (determine-build-type)
(hasheq 'service_name "cover"
'repo_token "abc")))
(with-env ("TRAVIS_JOB_ID" "abc")
(check-equal? (determine-build-type)
(hasheq 'service_name "travis-ci"
'service_job_id "abc"
'repo_token #f))))
;; Coverage [Hasheq String String] -> JSexpr ;; Coverage [Hasheq String String] -> JSexpr
;; Generates a string that represents a valid coveralls json_file object ;; Generates a string that represents a valid coveralls json_file object