https://github.com/chiefgokhlayeh/tap-consooomer
📦 Test Anything Protocol Consumer for Rust
https://github.com/chiefgokhlayeh/tap-consooomer
consumer parser peg test-anything-protocol
Last synced: 3 months ago
JSON representation
📦 Test Anything Protocol Consumer for Rust
- Host: GitHub
- URL: https://github.com/chiefgokhlayeh/tap-consooomer
- Owner: ChiefGokhlayeh
- License: apache-2.0
- Created: 2022-09-15T19:46:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T18:13:18.000Z (about 1 year ago)
- Last Synced: 2025-04-09T18:12:28.625Z (about 1 year ago)
- Topics: consumer, parser, peg, test-anything-protocol
- Language: Rust
- Homepage:
- Size: 305 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📦 tap-consooomer
_That's three o's._
[](https://crates.io/crates/tap-consooomer) [](https://github.com/ChiefGokhlayeh/tap-consooomer/actions/workflows/build_and_test.yaml) [](https://results.pre-commit.ci/latest/github/ChiefGokhlayeh/tap-consooomer/main) [](https://codecov.io/gh/ChiefGokhlayeh/tap-consooomer)
[Test Anything Protocol (TAP)](https://testanything.org/) Consumer for Rust. Capable of parsing [TAP14](https://testanything.org/tap-version-14-specification.html) files into [pest](https://github.com/pest-parser/pest) tokens.
## Usage
```txt
Reads a given Test Anything Protocol (TAP) file and prints the JSON-formatted parser result to
stdout. If FILE is omitted, TAP input is read from stdin. Parsing only comences after encountering
an EOF. Only complete TAP files are supported.
USAGE:
tap [FILE]
ARGS:
Path to TAP input file
OPTIONS:
-h, --help
Print help information
-V, --version
Print version information
```
## Examples
See [examples](examples) directory for some example TAP logs. To convert them into JSON run:
```sh
❯ tap examples/cascading.tap
```
The TAP log should be transformed as follows:
Input
Output
```tap
TAP version 14
1..3 # root
ok 1 - i'm in root
# subtest: here begins sub-1
2..2 # sub-1
ok 2 - i'm in sub-1
ok 3
```
➜
```json
{
"preamble": {
"version": "14"
},
"plan": {
"first": 1,
"last": 3,
"reason": "root"
},
"body": [
{
"test": {
"result": true,
"number": 1,
"description": "i'm in root",
"directive": null,
"yaml": []
}
},
{
"subtest": {
"name": "here begins sub-1",
"plan": {
"first": 2,
"last": 2,
"reason": "sub-1"
},
"body": [
{
"test": {
"result": true,
"number": 2,
"description": "i'm in sub-1",
"directive": null,
"yaml": []
}
}
]
}
},
{
"test": {
"result": true,
"number": 3,
"description": null,
"directive": null,
"yaml": []
}
}
]
}
```
## License
Licensed under
- Apache License, Version 2.0
([LICENSE](LICENSE) or )
## Limitations
- Embedded YAML blocks are parsed into a list of individual `yaml` lines. These are treated as plain-text and **not** broken down any further. Use any of your favorite [YAML libraries](https://crates.io/search?q=yaml) (like [serde_yaml](https://crates.io/crates/serde_yaml)) to further parse the embedded YAML block. Any indentation preceding the first element is used as the _anchor_ for the entire YAML block _and trimmed off_. Any line separators (`` or ``) at the end of any given `yaml` line are omitted. Empty or whitespace-only lines inside the embedded YAML block get removed.