This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [:db/add [:idos.cpc/email "asdf@qwer"] :idos.cpc/email "asdf@qwer"] | |
| (def invalid? | |
| (matches? | |
| #{nil | |
| ^:& [map? #(<= (count %) 1)] | |
| #{[_ [a v] a v] | |
| [_ _ :db/id _]}})) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns user.test | |
| (:refer-clojure :exclude [test]) | |
| (:require | |
| [meander.epsilon :as m] | |
| [taoensso.timbre :refer [error]])) | |
| (def tests-enabled true) | |
| (defmacro test [& body] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns contrib.do | |
| #?(:cljs (:require-macros [contrib.do]))) | |
| (defn tag-type [tag] | |
| (some->> (re-matches #"^([A-Z][-a-z]*)(.*)$" (name tag)) second keyword)) | |
| (defn typed-tag? [tag] | |
| (not (nil? (tag-type tag)))) | |
| (defn typed-action? [val] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns user.stage | |
| (:require | |
| [datomic.api :as d])) | |
| (defn with [$ tx] | |
| (:db-after (d/with $ tx))) | |
| (comment | |
| (datomic.api/create-database "datomic:mem://app-db") |
I am tired of black box magic test frameworks with long command line incantations and opaque source code that soaks up weeks of attention to understand, so I really want something lightweight like this to become popular. I don't yet know the gap between this and production test functionality, and don't have much attention to spend on this, what are your ideas?
I especially love Brandon Bloom's idea of (defmacro tests [body]) which can erase the tests at compile time depending on build target. Does this mean we can finally co-locate our tests with our functions, like Rich comment blocks?
(ns contrib.test
(:gen-class)
(:require
[clojure.spec.alpha :as s]
[taoensso.timbre :refer [warn error info]])) (def s (r/atom 0))
(defn foo []
[:input {:type "text"
:value @s
:on-click #(reset! s (.-target.value %)}]) ; unstable closure reference
(defn change [e] (reset! s (.-target.value e)) ; you're suggesting we name it(defn foo! [i]
(rand-nth (concat
(range 20)
[{:cognitect.anomalies/anomaly {:cognitect.anomalies/category :cognitect.anomalies/unavailable}}
{:cognitect.anomalies/anomaly {:cognitect.anomalies/category :cognitect.anomalies/busy}}
{:cognitect.anomalies/anomaly {:cognitect.anomalies/category :cognitect.anomalies/forbidden}}])))
(map foo! (range 15))Unbalanced if with effect
(defn- pprint-list [alis]
(if-not (pprint-reader-macro alis)
(pprint-simple-list alis)))When without effect
(defn- diff-associative-key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Mocha = require('mocha') | |
| var assert = require('assert') | |
| var _ = require('lodash') | |
| var mocha = new Mocha() | |
| mocha.suite.emit('pre-require', this, 'solution', mocha) | |
| describe('Test suite', function() { | |
| it('should work', function() { | |
| assert(true) |

