~/bend-docscommunity

src/ez/ends.bend checks

raw source on the hub · import ezx@1.15.0.0/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 (laws/ExitStatusSaysFailure.bend). That the answer is what bend printed is trusted (below). ez run reads no answer: it exits with the program's own status (code in ez/start.bend).

Trusted, not proved: a law may read snap's answers, code, text and ok, from src/answer.bend, the pure module snap's main.bend returns them from unchanged. ez imports that module deliberately, here and in the laws that read answers: bend 2.0.32's verdict fails every proof whose imports reach snap's foreign effects, which main.bend holds, so no law may import main.bend. That main.bend's code, text and ok are src/answer.bend's is snap's SNAP-TRUST-5, a one-line delegate each in snap v1.4.0, the rev ez.toml pins; the interpreters read the same answers through main.bend.

Trusted, not proved: the answer this file reads is what bend printed and the status it exited with, 128 plus the signal for one a signal ended and 127 for one that could not be started.

3 imports
import Base
import snap@1.4.0.0/src/answer.bend as R
import ../lock/plan.bend as P

Definitions

def outcome.of source · line 33 · raw

@passed:Bool -> 0x54c6454e798d1d497bdd6d0af3a8ac92/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 38 · raw

@up:Bool -> @+name:String -> 0x54c6454e798d1d497bdd6d0af3a8ac92/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 43 · raw

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

ez build: bend exited 0

def no.main source · line 59 · 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 67 · 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 76 · raw

@+out:String -> Bool

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

def checked source · line 80 · raw

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

ez check

def counted source · line 84 · raw

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

ez test and ez prove: every file passed