data-test/test/src/data_test_test.clj

39 lines
1.5 KiB
Clojure
Raw Normal View History

2019-05-17 10:26:01 +00:00
; 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-test
(:require
[clojure.test :refer :all]
2019-05-19 09:39:19 +00:00
[clojure.java.io :as io]
[schema.core :as s]
2019-05-29 17:18:57 +00:00
[data-test.loader :as loader]
2019-05-17 10:26:01 +00:00
[data-test :as sut]))
(s/set-fn-validation! true)
2019-05-22 20:31:15 +00:00
; -------------------- explicit version ------------------
2019-05-17 10:26:01 +00:00
(deftest should-test-with-data-explicit-version
2019-05-31 11:55:55 +00:00
(let [testdata (loader/read-test-data-spec (io/resource "data_test_test/should_test_with_data_explicit_version.edn"))
2019-05-29 17:18:57 +00:00
{:keys [input expected]} testdata]
(is (= expected
2019-05-17 10:26:01 +00:00
input))))
2019-05-22 20:31:15 +00:00
; ---------------------------- macro -----------------------------
2019-05-29 17:18:57 +00:00
(sut/defdatatest should-test-with-data-macro-version [input expected]
(is (= input expected)))
2019-05-28 16:53:08 +00:00
2019-05-29 17:18:57 +00:00
(sut/defdatatest should-test-multiple-specs [input expected]
(is (= input expected)))