Open epage opened 3 years ago
I think having a cut off limit with an env variable should do the trick
Putting my suggestion from the linked issue here too -- in the case of a large buffer, it may make sense to indent the whole thing slightly, so it stands out from the actual assertions.
Something like:
expected:
some multiline output
indented with
2 spaces
While skimming through the output, it becomes easy to spot the error messages and differentiate them from the printed buffer.
This is dependent on the library we use for the tree view because we don't know our indentation level.
We use treeline
which doesn't have much activity
https://lib.rs/crates/treeline
ptree also exists but seems a bit ... heavy weight https://lib.rs/crates/ptree
I'm assuming we'd reach out to treeline
and, if they don't respond, will fork it.
Before I forget, one downside of indenting everything, especially if the tree continues through that indentaton, is its a bit messier to take the output and copy/paste it somewhere.
Perhaps you could output the tree as YAML? YAML has multiline strings, indentation, and is both user and machine readable.
Its an interesting idea. The main problem is having a yaml generator that gives me control over formatting. Toml ones exist but its harder to find them for Yaml.
For example, with yaml-rust
(the core of serde-yaml
)
foo:
bar:
- 1
- 2
- 3
word: |
Hello
World
How
Are
You
Became
---
foo:
bar:
- 1
- 2
- 3
word: "Hello\nWorld\nHow\nAre\nYou"
You're right, Rust's YAML support is lacking. If we do this, we'll likely have to do the encoding ourselves.
See https://github.com/assert-rs/assert_cmd/issues/121 for an example
The main question is how to resolve this in a way that is what people expect and works for them.