Skip to content

Commit 6ceb253

Browse files
committed
readme - tighten
1 parent ce5b371 commit 6ceb253

File tree

1 file changed

+44
-33
lines changed

1 file changed

+44
-33
lines changed

README.md

+44-33
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,28 @@ RCF turns your Rich Comment Forms into tests (in the same file as your functions
66

77
Features
88
* Clojure/Script
9-
* Async tests
10-
* Zero boilerplate
11-
* Natural REPL workflow
12-
* No file watchers, no extra windows, no beeping, no latency
13-
* One key-chord to run tests, no hotkey configuring
9+
* async tests
10+
* zero boilerplate
11+
* natural REPL workflow
12+
* one key-chord to run tests, no hotkey configuring
13+
* same-file tests (examples are better than docstrings)
14+
* no file watchers, no extra windows, no beeping, no latency
15+
* notebook support – [example NextJournal notebook](https://nextjournal.com/dustingetz/missionary-relieve-backpressure)
16+
* it's fun! ✅✅✅
1417

15-
Deeper goal: **a notation for communication**
16-
* Documentation tool. RCF lets you share example usages next to the source code of the function (which is way better than docstrings). Figuring out what dense Clojure code does is actually really hard and RCF fixes that. [Example nextjournal notebook documentation using RCF](https://nextjournal.com/dustingetz/missionary-relieve-backpressure)
17-
* Pair programming tool. While pairing on Zoom, bang out some assertions quickly, right in the file you're working on. Watch your communication bandwidth improve.
18-
* Teaching tool. RCF helps beginners experiment and check their work.
19-
20-
RCF is specifically engineered to support [hyperfiddle/electric](https://github.com/hyperfiddle/electric), that we test, document and teach with RCF.
18+
RCF is specifically engineered to support [Electric Clojure](https://github.com/hyperfiddle/electric), which we test, document and teach with RCF.
2119

2220
Hype quotes:
2321
* "RCF has changed my habits with regards to tests. It is so much easier than flipping back and forth between files, you get my preferred work habits - work in a comment block until something works. But before RCF I never took the time to turn comment blocks into an automated test"
24-
* "I think people make the mistake of comparing this with other methods of inlining tests near their function definitions (which has been possible, though uncommon, for a long time). The integration with the REPL, low syntax/interface, reduces friction and makes testing more attractive as a language of communication and verification."
25-
* "I used RCF in a successful interview. RCF was a massive help in communication and a fast tool for thought whilst under the conditions of technical interview."
2622
* "I use RCF to do leetcode style questions as 'fun practice.' It certainly didn't feel fun before!"
23+
* "I think people make the mistake of comparing this with other methods of inlining tests near their function definitions. The integration with the REPL, low syntax/interface, reduces friction and makes testing more attractive as a language of communication and verification."
24+
* "I used RCF in a successful interview. RCF was a massive help in communication and a fast tool for thought whilst under the conditions of technical interview."
2725

2826
# Dependency
2927

30-
Project maturity: CLJ is stable, external users. CLJS is alpha
28+
Project maturity: CLJ is stable, CLJS is experimental.
3129

3230
```clojure
33-
; stable
3431
{:deps {com.hyperfiddle/rcf {:mvn/version "20220926-202227"}}}
3532
```
3633

@@ -41,13 +38,8 @@ Breaking changes:
4138
* 2021 Dec 18: clojurescript dependency is now under the :cljs alias, see #25
4239
* 2021 Oct 20: custom reporters now dispatch on qualified keywords, see #19
4340

44-
Experimental (master): the current development priority is improving complex async tests in
45-
ClojureScript, DX and some experiments with unification.
41+
Current dev priority is improving complex async tests in ClojureScript.
4642

47-
```Clojure
48-
; development - not currently published
49-
;{:deps {com.hyperfiddle/rcf {:git/url "https://github.com/hyperfiddle/rcf.git" :sha ...}}}
50-
```
5143
[![JVM](https://github.com/hyperfiddle/rcf/actions/workflows/tests_clj.yml/badge.svg?branch=master)](https://github.com/hyperfiddle/rcf/actions/workflows/tests_clj.yml)
5244
[![NodeJS](https://github.com/hyperfiddle/rcf/actions/workflows/tests_node.yml/badge.svg?branch=master)](https://github.com/hyperfiddle/rcf/actions/workflows/tests_node.yml)
5345
[![Browser](https://github.com/hyperfiddle/rcf/actions/workflows/tests_browser.yml/badge.svg?branch=master)](https://github.com/hyperfiddle/rcf/actions/workflows/tests_browser.yml)
@@ -64,7 +56,7 @@ It's an easy one-liner to turn on tests in your dev entrypoint:
6456

6557
(hyperfiddle.rcf/enable!)
6658
```
67-
Tests are run when you send a file or form to your Clojure/Script REPL. In Cursive, that's cmd-shift-L to load the file.
59+
Tests are run when you send a file or form to your Clojure/Script REPL.
6860

6961
```clojure
7062
(ns example
@@ -126,7 +118,8 @@ Loading src/example.cljc...
126118
```Clojure
127119
(ns example
128120
(:require [clojure.core.async :refer [chan >! go go-loop <! timeout close!]]
129-
[hyperfiddle.rcf :as rcf :refer [tests tap %]]
121+
[hyperfiddle.electric :as e]
122+
[hyperfiddle.rcf :as rcf :refer [tests tap % with]]
130123
[missionary.core :as m]))
131124

132125
(rcf/set-timeout! 100)
@@ -135,21 +128,38 @@ Loading src/example.cljc...
135128
"async tests"
136129
#?(:clj (tests
137130
(future
138-
(rcf/tap 1) (Thread/sleep 10) ; tap value to queue
139-
(rcf/tap 2) (Thread/sleep 200)
140-
(rcf/tap 3))
131+
(tap 1) (Thread/sleep 10) ; tap value to queue
132+
(tap 2) (Thread/sleep 200)
133+
(tap 3))
141134
% := 1 ; pop queue
142135
% := 2
143136
% := ::rcf/timeout)
144137
:cljs (tests
145138
(defn setTimeout [f ms] (js/setTimeout ms f))
146-
(rcf/tap 1) (setTimeout 10 (fn []
147-
(rcf/tap 2) (setTimeout 200 (fn []
148-
(rcf/tap 3)))))
139+
(tap 1) (setTimeout 10 (fn []
140+
(tap 2) (setTimeout 200 (fn []
141+
(tap 3)))))
149142
% := 1
150143
% := 2
151-
% := ::rcf/timeout))
144+
% := ::rcf/timeout)))
145+
146+
(tests
147+
"electric"
148+
(def !x (atom 0))
149+
(def dispose
150+
(e/run
151+
(let [x (e/watch !x)
152+
a (inc x)
153+
b (inc x)]
154+
(tap (+ a b)))))
155+
% := 2
156+
(swap! !x inc)
157+
% := 4
158+
(swap! !x inc)
159+
% := 6
160+
(dispose))
152161

162+
(tests
153163
"core.async"
154164
(def c (chan))
155165
(go-loop [x (<! c)]
@@ -160,8 +170,9 @@ Loading src/example.cljc...
160170
(go (>! c :hello) (>! c :world))
161171
% := :hello
162172
% := :world
163-
(close! c)
173+
(close! c))
164174

175+
(tests
165176
"missionary"
166177
(def !x (atom 0))
167178
(def dispose ((m/reactor (m/stream! (m/ap (! (inc (m/?< (m/watch !x)))))))
@@ -171,7 +182,7 @@ Loading src/example.cljc...
171182
(swap! !x inc)
172183
% := 2
173184
% := 3
174-
(dispose))
185+
(dispose)))
175186
```
176187

177188
# CI
@@ -194,7 +205,7 @@ Ran 1 tests containing 8 assertions.
194205

195206
# ClojureScript configuration
196207

197-
For CLJS tests to run, `rcf/enable!` must be true in both CLJ (shadow-cljs macroexpansion time) and CLJS (JS runtime). Successful runs will print green checkboxes in the browser console, not the REPL, because REPLs don't properly intercept the async println. (Please file an issue or DM us on slack if you can help us understand why.)
208+
For CLJS tests to run, `rcf/enable!` must be true **in both CLJ (shadow-cljs macroexpansion time) and CLJS (JS runtime)**. Reports may be printed to **browser console instead of the REPL**, because browser REPLs donn't intercept the async println.
198209

199210
```Clojure
200211
(ns dev-entrypoint

0 commit comments

Comments
 (0)