~/bend-docscommunity

src/ez/ends.bend checks

raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/src/ez/ends.bend as Ends

ez/ends: how the commands that are not planners end. ez check and ez build start one bend and end on its answer; ez test and ez prove start one per file and end on the count. Each ends with a P.Outcome, the same end a planner's plan has, and the interpreter exits with its P.status (Run.end), so the status each exits with is a law (EZ-OUT-1). That the answer is what bend printed is EZ-TRUST-2. ez run reads no answer: it exits with the program's own status (code in ez/start.bend).

3 imports
import Base
import 0xabe575924687afad4cee1a2c1194d639/src/answer.bend as R
import ../lock/plan.bend as P

Definitions

def outcome.of source · line 18 · raw

@passed:Bool -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Outcome

a command that ends on whether it passed: success, or a refusal whose reason was already printed

def lock.flags source · line 23 · raw

@up:Bool -> @+name:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Outcome

ez lock --package NAME without --upgrade is a line ez refuses before it reads anything, since --package only filters an upgrade

def ran source · line 28 · raw

@+out:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Outcome

ez build: bend exited 0

def no.main source · line 44 · raw

@+line:String -> Bool

bend f -o out checks without running main. A clean file prints nothing at all, and a library entry, having no main, checks clean and then exits 1 with "no main to run" from the emit. A check failure throws before the emit, so that message can only follow a check that passed.

It is matched as a whole line, because that is the shape of the thing being claimed: bend prints it as Error: no main to run and nothing else. Asked as a substring of the whole output, the same words appearing anywhere (inside some other error's text, or in a source line bend echoed back while reporting on it) would answer yes and mean nothing, and a failing check would read as a passing one. Two other line-shaped facts in this tree were being asked of whole files the same way, and one of them silently dropped a test before it was caught.

def said.no.main source · line 52 · raw

@ls:List<&2, String> -> Bool

whether any line of the output is that one. The rest of the walk is bound before the Bool.or rather than written under it: Bool.or is an ordinary function and reduces both sides, so a recursive call sitting inside one is not a branch the condition can decline. Bound first it is a plain fold over a handful of lines, which is what the rest of this tree does too.

def check.passed source · line 61 · raw

@+out:String -> Bool

whether ez check passed: bend exited 0, or said only that there is no main

def checked source · line 65 · raw

@+out:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Outcome

ez check

def counted source · line 69 · raw

@+passed:Nat -> @+total:Nat -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Outcome

ez test and ez prove: every file passed