Back

compose-fixtures (clj)

(source)

function

(compose-fixtures f1 f2)
Composes two fixture functions, creating a new fixture function that combines their behavior.

Examples

clojure/core.typed
(ns clojure.core.typed.test.testnew
  (:require [clojure.core.typed :as t] 
            [clojure.test :refer :all]                
            [clojure.core.typed.test.test-utils :refer :all]
            [clojure.core.typed.test.destructure]))

(deftest function?-test
  (is-tc-e (function? function?) Boolean
             :requires [[clojure.test :refer [function?]]])
  (is-tc-err (function? function?) String
             :requires [[clojure.test :refer [function?]]]))
  
(deftest assert-any-test
  (is-tc-e (assert-any "Hi" (= 4 (+ 2 2))) Any
           :requires [[clojure.test :refer [assert-any]]]))
           
(deftest do-report-test
  (is-tc-e #(do-report 1)
           :requires [[clojure.test :refer [do-report]]]))
            
(deftest run-tests-test
  (is-tc-e #(run-tests) [-> (Map Any Any)]
           :requires [[clojure.test :refer [run-tests]]])
  (is-tc-err #(run-tests) [-> String]
             :requires [[clojure.test :refer [run-tests]]]))
            
(deftest run-all-tests-test
  (is-tc-e #(run-all-tests) [-> (Map Any Any)]
           :requires [[clojure.test :refer [run-all-tests]]])
  (is-tc-e #(run-all-tests #"asdf") [-> (Map Any Any)]
           :requires [[clojure.test :refer [run-all-tests]]])
  (is-tc-err #(run-all-tests) [:-> String]
             :requires [[clojure.test :refer [run-all-tests]]]))
            
(deftest successful?-test
  (is-tc-e #(successful? {}) [-> Boolean]
           :requires [[clojure.test :refer [successful?]]]))
            
(deftest compose-fixtures-test
  (is-tc-e (compose-fixtures (fn [a :- [-> Any]] (a)) 
                             (fn [b :- [-> Any]] (b)))
           [[-> Any] -> Any]
           :requires [[clojure.test :refer [compose-fixtures]]]))
           
(deftest testing-vars-str-test
  (is-tc-e #(testing-vars-str {}) [-> String]
           :requires [[clojure.test :refer [testing-vars-str]]])
  (is-tc-err (testing-vars-str 1) Int
             :requires [[clojure.test :refer [testing-vars-str]]]))
           
(deftest testing-contexts-str-test
  (is-tc-e (testing-contexts-str)  String
           :requires [[clojure.test :refer [testing-contexts-str]]])
  (is-tc-err (testing-contexts-str) (Map Any Any)
             :requires [[clojure.test :refer [testing-contexts-str]]])
  (is-tc-err (testing-contexts-str 1)  String
             :requires [[clojure.test :refer [testing-contexts-str]]]))
clojure-emacs/cider-nrepl
(ns cider.nrepl.piggieback-test
  (:require
   [cider.piggieback :as piggieback]
   [cider.nrepl.test-session :as session]
   [cider.nrepl.middleware :refer [cider-middleware]]
   [cljs.repl.node :as node]
   [clojure.test :refer :all]
   [nrepl.core :as nrepl]
   [nrepl.server :as server]))

(def piggieback-fixture
  (compose-fixtures
   session/session-fixture
   (fn [f]
     (binding [session/*handler* (apply server/default-handler
                                        (conj (map resolve cider-middleware)
                                              #'piggieback/wrap-cljs-repl))]
       ;; TODO check the result of this; we shouldn't run any tests if it fails
       (dorun (session/message
               {:op "eval"
                :code (nrepl/code (require '[cider.piggieback :as piggieback])
                                  (piggieback/cljs-repl @cider.nrepl.piggieback-test/repl-env))}))
       (dorun (session/message {:op "eval"
                                :code (nrepl/code (require 'clojure.data))}))
       (f)
       (session/message {:op "eval"
                         :code (nrepl/code :cljs/quit)})))))
immutant/immutant
(ns integs.cluster-test
  (:require [fntest.core :refer :all]
            [clojure.test :refer :all]
            [environ.core :refer (env)]
            [integs.cluster-help :refer (get-as-data stop start mark) :as u]
            [immutant.messaging :as msg]))

(use-fixtures :once
  (compose-fixtures
    (partial with-jboss #{:isolated :offset :domain})
    (with-deployment "ROOT.war" "." :profiles profiles)))
typedclojure/typedclojure
(ns clojure.core.typed.test.testnew
  (:require [typed.clojure :as t]
            [clojure.test :refer :all]
            [typed.clj.checker.test-utils :refer :all]))

(deftest function?-test
  (is-tc-e (function? function?) t/Bool
           :requires [[clojure.test :refer [function?]]])
  (is-tc-err (function? function?) t/Str
             :requires [[clojure.test :refer [function?]]]))
  
(deftest assert-any-test
  (is-tc-e (assert-any "Hi" (= 4 (+ 2 2))) t/Any
           :requires [[clojure.test :refer [assert-any]]]))
           
(deftest do-report-test
  (is-tc-e #(do-report 1)
           :requires [[clojure.test :refer [do-report]]]))
            
(deftest run-tests-test
  (is-tc-e #(run-tests) [-> (t/Map t/Any t/Any)]
           :requires [[clojure.test :refer [run-tests]]])
  (is-tc-err #(run-tests) [-> t/Str]
             :requires [[clojure.test :refer [run-tests]]]))
            
(deftest run-all-tests-test
  (is-tc-e #(run-all-tests) [-> (t/Map t/Any t/Any)]
           :requires [[clojure.test :refer [run-all-tests]]])
  (is-tc-e #(run-all-tests #"asdf") [-> (t/Map t/Any t/Any)]
           :requires [[clojure.test :refer [run-all-tests]]])
  (is-tc-err #(run-all-tests) [:-> t/Str]
             :requires [[clojure.test :refer [run-all-tests]]]))
            
(deftest successful?-test
  (is-tc-e #(successful? {}) [-> t/Bool]
           :requires [[clojure.test :refer [successful?]]]))
            
(deftest compose-fixtures-test
  (is-tc-e (compose-fixtures (fn [a :- [-> t/Any]] (a)) 
                             (fn [b :- [-> t/Any]] (b)))
           [[-> t/Any] -> t/Any]
           :requires [[clojure.test :refer [compose-fixtures]]]))
           
(deftest testing-vars-str-test
  (is-tc-e #(testing-vars-str {}) [-> t/Str]
           :requires [[clojure.test :refer [testing-vars-str]]])
  (is-tc-err (testing-vars-str 1) t/Int
             :requires [[clojure.test :refer [testing-vars-str]]]))
           
(deftest testing-contexts-str-test
  (is-tc-e (testing-contexts-str) t/Str
           :requires [[clojure.test :refer [testing-contexts-str]]])
  (is-tc-err (testing-contexts-str) (t/Map t/Any t/Any)
             :requires [[clojure.test :refer [testing-contexts-str]]])
  (is-tc-err (testing-contexts-str 1) t/Str
             :requires [[clojure.test :refer [testing-contexts-str]]]))
finnishtransportagency/harja
(ns harja.palvelin.integraatiot.api.urakan-tyotunnit-test
  (:require [clojure.test :refer :all]
            [com.stuartsierra.component :as component]
            [harja.testi :refer :all]
            [harja.palvelin.integraatiot.api.urakan-tyotunnit :as urakan-tyotunnit]
            [harja.palvelin.integraatiot.api.tyokalut :as api-tyokalut]
            [clojure.java.io :as io]
            [org.httpkit.fake :refer [with-fake-http]]))

(use-fixtures :once (compose-fixtures tietokanta-fixture
                                      jarjestelma-fixture))