docs: add $# comment line syntax

This commit is contained in:
Chris Wanstrath 2026-03-12 16:14:44 -07:00
parent 1ddee9ea9e
commit 7df105d02a
3 changed files with 17 additions and 0 deletions

View File

@ -36,6 +36,7 @@ Transcript-based shell integration test runner. Bun + TypeScript.
- `...` inline = matches any characters on that line - `...` inline = matches any characters on that line
- `[N]` on last line of expected output = assert exit code N - `[N]` on last line of expected output = assert exit code N
- `[*]` = assert any non-zero exit code; default expects 0 - `[*]` = assert any non-zero exit code; default expects 0
- `$#` comment line = not executed, no output expected (e.g. `$# start the server`)
- `#` after a command = comment (stripped); `#` in expected output is literal - `#` after a command = comment (stripped); `#` in expected output is literal
- `@env KEY=VALUE` before first command = set environment variable - `@env KEY=VALUE` before first command = set environment variable
- `@setup path.shout` before first command = prepend commands (and `@env`) from another file - `@setup path.shout` before first command = prepend commands (and `@env`) from another file

View File

@ -30,6 +30,16 @@ ls: missing: No such file or directory
`[1]` after the expected output matches the exit code. `[1]` after the expected output matches the exit code.
`$#` is a comment line — not executed, no output expected:
```
$# start the server
$ my-server &
$# now test it
$ curl localhost:8080
OK
```
## Usage ## Usage
``` ```

View File

@ -196,6 +196,12 @@
<span class="output">Homebrew 5</span><span class="wildcard">...</span></code></pre> <span class="output">Homebrew 5</span><span class="wildcard">...</span></code></pre>
<p><code class="wildcard">...</code> matches anything &mdash; inline or across lines.</p> <p><code class="wildcard">...</code> matches anything &mdash; inline or across lines.</p>
<p><code class="exit-code">[1]</code> asserts the exit code.</p> <p><code class="exit-code">[1]</code> asserts the exit code.</p>
<p><code class="dim">$#</code> starts a comment line &mdash; not executed, no output expected.</p>
<pre><code><span class="prompt">$</span><span class="comment"># start the server</span>
<span class="prompt">$</span> <span class="cmd">my-server &amp;</span>
<span class="prompt">$</span><span class="comment"># now test it</span>
<span class="prompt">$</span> <span class="cmd">curl localhost:8080</span>
<span class="output">OK</span></code></pre>
</section> </section>
<section> <section>