Internal utilities for testing clara-rules and derivative projects. These should be considered experimental right now from the perspective of consumers of clara-rules, although it is possible that this namespace will be made part of the public API once its functionality has proven robust and reliable. The focus, however, is functionality needed to test the rules engine itself.
Internal utilities for testing clara-rules and derivative projects. These should be considered experimental right now from the perspective of consumers of clara-rules, although it is possible that this namespace will be made part of the public API once its functionality has proven robust and reliable. The focus, however, is functionality needed to test the rules engine itself.
(assert-ex-data expected-ex-data form)
(assert-ex-data expected-ex-message expected-ex-data form)
(def-rules-test name params & forms)
This macro allows creation of rules, queries, and sessions from arbitrary combinations of rules and queries in a setup map without the necessity of creating a namespace or defining a session using defsession in both Clojure and ClojureScript. The first argument is the name of the test, and the second argument is a map with entries :rules, :queries, and :sessions. For example usage see clara.test-testing-utils. Note that sessions currently can only contain rules and queries defined in the setup map; supporting other rule sources such as namespaces and defrule/defquery may be possible in the future.
Namespaces consuming this macro are expected to require clara.rules and either clojure.test or cljs.test. Unfortunately, at this time we can't add inline requires for these namespace with the macroexpanded code in ClojureScript; see https://anmonteiro.com/2016/10/clojurescript-require-outside-ns/ for some discussion on the subject. However, the test namespaces consuming this will in all likelihood have these dependencies anyway so this probably isn't a significant shortcoming of this macro.
This macro allows creation of rules, queries, and sessions from arbitrary combinations of rules and queries in a setup map without the necessity of creating a namespace or defining a session using defsession in both Clojure and ClojureScript. The first argument is the name of the test, and the second argument is a map with entries :rules, :queries, and :sessions. For example usage see clara.test-testing-utils. Note that sessions currently can only contain rules and queries defined in the setup map; supporting other rule sources such as namespaces and defrule/defquery may be possible in the future. Namespaces consuming this macro are expected to require clara.rules and either clojure.test or cljs.test. Unfortunately, at this time we can't add inline requires for these namespace with the macroexpanded code in ClojureScript; see https://anmonteiro.com/2016/10/clojurescript-require-outside-ns/ for some discussion on the subject. However, the test namespaces consuming this will in all likelihood have these dependencies anyway so this probably isn't a significant shortcoming of this macro.
(ex-data-maps t)
Given a throwable/exception/error t
, return all ex-data
maps from the stack trace cause chain in
the order they occur traversing the chain from this t
through the rest of the call stack.
Given a throwable/exception/error `t`, return all `ex-data` maps from the stack trace cause chain in the order they occur traversing the chain from this `t` through the rest of the call stack.
(get-all-ex-data e)
Walk a Throwable chain and return a sequence of all data maps from any ExceptionInfo instances in that chain.
Walk a Throwable chain and return a sequence of all data maps from any ExceptionInfo instances in that chain.
(join-filter-equals & args)
Intended to be a test function that is the same as equals, but is not visible to Clara as such and thus forces usage of join filters instead of hash joins
Intended to be a test function that is the same as equals, but is not visible to Clara as such and thus forces usage of join filters instead of hash joins
(run-performance-test form)
Created as a rudimentary alternative to criterium, due to assumptions made during benchmarking. Specifically, that criterium attempts to reach a steady state of compiled and loaded classes. This fundamentally doesn't work when the metrics needed rely on compilation or evaluation.
Created as a rudimentary alternative to criterium, due to assumptions made during benchmarking. Specifically, that criterium attempts to reach a steady state of compiled and loaded classes. This fundamentally doesn't work when the metrics needed rely on compilation or evaluation.
(side-effect-holder-fixture t)
Fixture to reset the side effect holder to nil both before and after tests. This should be used as a :each fixture.
Fixture to reset the side effect holder to nil both before and after tests. This should be used as a :each fixture.
(test-compile-async-action node-id binding-keys rhs env)
Compile the right-hand-side action of a rule as an async action for testing
Compile the right-hand-side action of a rule as an async action for testing
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close