AtlatestRepositoryfolio

folio / tree / test / fixturesf1b-witness-folio.sgd

1#lang folio/doc
2@(import (sigil fs))
3@(define (witness-sentinel name)
4 (write-file-string
5 (string-append (or (getenv "F1B_WITNESS_DIR") "/tmp") "/f1b-witness-" name)
6 "TRIPPED"))
7@(display "F1B-WITNESS-EXPR-RAN\n")
8@(witness-sentinel "expr")
9@(define (tripwire-command . body)
10 (display "F1B-WITNESS-COMMAND-RAN\n")
11 (witness-sentinel "command")
12 body)
13@(define (midprose-command . body)
14 (display "F1B-WITNESS-MIDPROSE-COMMAND-RAN\n")
15 (witness-sentinel "midprose-command")
16 '())
17@(define-syntax macro-tripwire
18 (syntax-rules ()
19 ((_ body ...)
20 (begin (display "F1B-WITNESS-MACRO-RAN\n")
21 (witness-sentinel "macro")
22 body ...))))
23@note["topics/f1b-witness" title: "No-execution witness" tags: '("folio")]
25@p{This manuscript exists to prove the no-execution detector can SEE execution.
26Under @code{#lang sigil/doc} every channel below must trip; under
27@code{#lang folio/doc} the manuscript must be REFUSED at read time and none of
28them may trip. The gate runs both in the same arm, so an all-empty result cannot
29be mistaken for a clean one.}
31@tripwire-command{An author-defined command whose body runs only under
32evaluation.}
34Bare prose, deliberately NOT wrapped in a paragraph command. The attempt below
35sits MID-LINE and that is the whole point: a command or expression at the START
36of a line is at a BLOCK boundary, where lowering demands it produce document
37nodes. Inline expression @(begin (display "F1B-WITNESS-MIDPROSE-RAN\n") (witness-sentinel "midprose") '()) sits here, and inline command @midprose-command{author command} sits here, so SD-P3's fold is exercised rather than assumed.
39@(macro-tripwire (display "F1B-WITNESS-MACRO-USE-RAN\n")
40 '())
42@code["sigil"]{@(display "F1B-WITNESS-CODE-BODY-RAN\n")}
44@end note