~/bend-docscommunity

src/ez/test.bend relies on unsafe/foreign

raw source on the hub · import ezx@1.18.0.0/src/ez/test.bend as Test

ez/test: the test runner. Bend has none, so a test is a */tests/*.bend file that prints, and states in a #| trailer the lines its run must print. Each test is its own bend run, since what these drive is git, nix and bend itself, and each wants its own process, scratch directory and port. A run disagreeing with its trailer is a failure, and any failure is a non-zero exit.

Tests are not the proof gate. ez prove is, and nothing here runs a proof.

13 imports
import Base
import snap@1.6.0.0/main.bend as R
import ../io/file.bend as F
import ../share/env.bend as Env
import ../share/cap.bend as Cap
import ./gate.bend as G
import ./quiet.bend as Q
import ./clock.bend as Clock
import ./timer.bend as Timer
import ./prove.bend as P
import ./verdict.bend as V
import ../ez/ends.bend as E
import ../lock/run.bend as Run

Definitions

def say source · line 26 · raw

@ok:Bool -> @name:String -> @want:String -> @got:String -> IO(Unit)

a comparison that held says nothing. One that did not prints both sides in full: a diff is real work in Bend, and for a handful of short lines the pair reads better than one would.

def check source · line 35 · raw

@name:String -> @+wanted:String -> @+got:String -> @score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally)

what was wanted against what happened, reported and counted

def one source · line 41 · raw

@+path:String -> @+output:String -> @score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally)

one test against its own trailer

def short source · line 50 · raw

@ts:List<&2, String> -> @score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally)

every test the answers ran out before. The two lists are the same length by construction and this should never have one to report, but the alternative to saying so is a green count over fewer tests than the tree holds, which is the worst answer a gate can give.

def report source · line 60 · raw

@ts:List<&2, String> -> @as:List<&2, String> -> @score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally)

every test, in the tree's order however the run happened to interleave

def find source · line 70 · raw

IO(List<&2, String>)

every test file

def done.go source · line 75 · raw

@+passed:Nat -> @+total:Nat -> IO(Unit)

the count, and the exit status it implies. The reminder sits above the count and never below it: a run's last line is its verdict, and something reads it.

def done source · line 82 · raw

@score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(Unit)

what a whole run amounts to

def out.at source · line 87 · raw

String

where the jobs of a run write what they print

def budget source · line 93 · raw

@late:Bool -> @+secs:String -> @score:0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally -> IO(0x2414c9622cab2353684d02a392804eb1/src/ez/verdict.Tally)

the budget checked the way every other thing here is checked. A run that overran is a run that failed, and it says so in the count rather than merely taking a long time.

def run source · line 108 · raw

IO(Unit)

ez test: every test in the tree, all of them at once. Nothing here is ordered against anything else, since each test has its own scratch directory and port, and the report is still walked in the tree's order whatever order the jobs finished in.