bbt is what you get when you take “docs is code” literally: the documentation is the test suite.
Describe your scenarios in near-natural language in the format of your Markdown documentation, and then just run this doc.
This release delivers two major features:
1. Comparison modifiers
When comparing an output with a reference file, or with an expected output, you often have to do acrobatics to neutralize the unpredictable parts of the output:
- time tags:
Oct 26 19:52:03 myhost sshd[1234]: warning: 3 authentication failures; remote 192.168.1.42 - source locations:
test.c:6:17: note: expansion point is location 283648 - paths: because
c:\tmpand/tmpthat are both OK
etc.
This version makes it easy: just state, on the comparison step line, what you ignore.
- When I run ....
- Then I get (ignoring time)
```
[12:34:56] Building foo
[12:34:56] Done
```
You can ignore time tags, order, version, dir, and more to come.
The command line options that drive how casing / empty lines / spaces are handled are now integrated into this mechanism.
Patterns can be combined: (ignoring time, order and dir)
And last but not least, any pattern can be masked with a regexp: (ignoring [0-9.]+). »
2. Shell steps
Some commands only make sense through a shell — pipes, redirections, command substitutions. You used to spawn the shell explicitly, e.g. When I run `sh -c "cmd1 | cmd2 > out"` . This version gives them first class steps:
- When I run shell `ls | wc -l > count.txt`
The shell is selected with the --shell option or the BBT_SHELL environment variable, among sh, bash, dash, zsh, fish, cmd, powershell and pwsh — defaulting to sh on POSIX and cmd.exe on Windows. And no more shell metacharacter warning on those steps: the metacharacters are exactly the point.
bbt 0.6.0 is available on Alire (alr install bbt) for Linux/Mac/Windows.
For the other changes and fixes, see the complete changelog