From d8c3ee5573a8e3c8e3148a4fa50dd7f82391b06e Mon Sep 17 00:00:00 2001 From: jem Date: Wed, 29 May 2019 19:26:32 +0200 Subject: [PATCH] instrument all test reporters --- main/src/data_test/reporter.clj | 3 +++ test/src/data_test/loader_test.clj | 1 - test/src/data_test/reporter_test.clj | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/src/data_test/reporter_test.clj diff --git a/main/src/data_test/reporter.clj b/main/src/data_test/reporter.clj index 19408cb..ccbfd3a 100644 --- a/main/src/data_test/reporter.clj +++ b/main/src/data_test/reporter.clj @@ -41,6 +41,7 @@ :test-data-spec *data-test-report-context*}))) (defmethod t/report :default [m] + (when *data-test-report-context* (write-data-test-output m)) (t/with-test-out (prn m))) (defmethod t/report :pass [m] @@ -48,6 +49,7 @@ (t/with-test-out (t/inc-report-counter :pass))) (defmethod t/report :fail [m] + (when *data-test-report-context* (write-data-test-output m)) (t/with-test-out (t/inc-report-counter :fail) (println "\nFAIL in" (t/testing-vars-str m)) @@ -57,6 +59,7 @@ (println " actual:" (pr-str (:actual m))))) (defmethod t/report :error [m] + (when *data-test-report-context* (write-data-test-output m)) (t/with-test-out (t/inc-report-counter :error) (println "\nERROR in" (t/testing-vars-str m)) diff --git a/test/src/data_test/loader_test.clj b/test/src/data_test/loader_test.clj index 92a934b..e53be4c 100644 --- a/test/src/data_test/loader_test.clj +++ b/test/src/data_test/loader_test.clj @@ -17,7 +17,6 @@ (:require [clojure.test :refer :all] [clojure.java.io :as io] - [schema.core :as s] [data-test.loader :as sut])) (deftest should-read-test-data-spec diff --git a/test/src/data_test/reporter_test.clj b/test/src/data_test/reporter_test.clj new file mode 100644 index 0000000..e87e0fd --- /dev/null +++ b/test/src/data_test/reporter_test.clj @@ -0,0 +1,19 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. +(ns data-test.reporter-test + (:require + [clojure.test :refer :all] + [data-test.reporter :as sut]))