Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Getz dustingetz

View GitHub Profile
View minitest-example.clj
(ns hyperfiddle.via
(:require
[meander.epsilon :as m :refer [match]]
[meander.strategy.epsilon :as r]
[minitest :refer [tests]]))
(comment
; Goal here is to implement async/await sugar like this:
(via* (->Maybe)
View rewrite-await.cljc
(ns user.dustin.bind10
(:require
[contrib.do :refer [Do-via via* !]]
[meander.epsilon :as m :refer [rewrite]]
[meander.strategy.epsilon :as r]))
(declare do> mlet pure fmap fapply bind)
(comment
View minitest.clj
(ns user.dustin.minitest2
(:refer-clojure :exclude [test])
(:require
[meander.epsilon :as m]
[taoensso.timbre :refer [error]]))
(declare tests test!)
(def ^:dynamic *tests* (atom {}))
@dustingetz
dustingetz / install-Python-AmazonLinux-20171023.log
Created Aug 10, 2020 — forked from mrthomaskim/install-Python-AmazonLinux-20171023.log
Amazon Linux AMI, pyenv, virtualenv, Python, ... Hello, World!
View install-Python-AmazonLinux-20171023.log
### prerequisites
sudo yum groupinstall "Development Tools"
git --version
gcc --version
bash --version
python --version # (system)
sudo yum install -y openssl-devel readline-devel zlib-devel
sudo yum update
### install `pyenv`
View match.clj
[: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 _]}}))
View microtest.clj
(ns user.test
(:refer-clojure :exclude [test])
(:require
[meander.epsilon :as m]
[taoensso.timbre :refer [error]]))
(def tests-enabled true)
(defmacro test [& body]
View do-via.cljc
(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]
View datomic stage .clj
(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")
View contrib-test.md

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]]))
You can’t perform that action at this time.