~/bend-docscommunity

src/ez/test.bend fails

raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/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.

12 imports
import Base
import 0xabe575924687afad4cee1a2c1194d639/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 ../ez/ends.bend as E
import ../lock/run.bend as Run

Types

type Tally source · line 23 · raw

Data

how many comparisons were made, and how many of them held

Definitions

def say source · line 29 · 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 tally.go source · line 38 · raw

@ok:Bool -> @passed:Nat -> @total:Nat -> Tally

one more comparison, and one more pass when it held

def tally source · line 46 · raw

@ok:Bool -> @score:Tally -> Tally

the tally with this comparison's verdict in it

def check source · line 51 · raw

@name:String -> @+wanted:String -> @+got:String -> @score:Tally -> IO(Tally)

what was wanted against what happened, reported and counted

def one source · line 57 · raw

@+path:String -> @+output:String -> @score:Tally -> IO(Tally)

one test against its own trailer

def short source · line 66 · raw

@ts:List<&2, String> -> @score:Tally -> IO(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 76 · raw

@ts:List<&2, String> -> @as:List<&2, String> -> @score:Tally -> IO(Tally)

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

def find source · line 86 · raw

IO(List<&2, String>)

every test file

def done.go source · line 91 · 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 98 · raw

@score:Tally -> IO(Unit)

what a whole run amounts to

def out.at source · line 103 · raw

String

where the jobs of a run write what they print

def budget source · line 109 · raw

@late:Bool -> @+secs:String -> @score:Tally -> IO(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 124 · 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.