assert-rs / snapbox

Snapshot testing for a herd of CLI tests
docs.rs/trycmd
Apache License 2.0
138 stars 18 forks source link

Markdown code blocks without a command should be skipped #190

Closed figsoda closed 1 year ago

figsoda commented 1 year ago

minimal reproducible example:

# README.md
```
```

output of cargo test:

running 1 test
Testing README.md:setup ... failed
Failed: Expected `$` on line 3, got ````
`

Update snapshots with `TRYCMD=overwrite`
Debug output with `TRYCMD=dump`
test cli ... FAILED

failures:

---- cli stdout ----
thread 'cli' panicked at '1 of 1 tests failed', /home/figsoda/.cargo/registry/src/github.com-1ecc6299db9ec823/trycmd-0.14.6/src/runner.rs:93:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    cli
figsoda commented 1 year ago

non-empty code block without a command should also be skipped IMO

epage commented 1 year ago

I feel like at that point a tag should be put on the code fence, either a ignore or a relevant lang.

Now, another topic maybe worth discussing is whether we should assume code blocks without a trycmd or console lang are for trycmd.