This repository has been archived by the owner on Dec 29, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(output): Re-work API to work with rustfmt
rustfmt will split long builers across lines, even when that breaks logical grouping. For example ```rust assert_cli::Assert::command(&["ls", "foo-bar-foo"]) .fails() .and() .stderr().contains("foo-bar-foo") .unwrap(); ``` will be turned into ```rust assert_cli::Assert::command(&["ls", "foo-bar-foo"]) .fails() .and() .stderr() .contains("foo-bar-foo") .unwrap(); ``` which obscures intent. Normally, I don't like working around tools but this one seems sufficient to do so. ```rust assert_cli::Assert::command(&["ls", "foo-bar-foo"]) .fails() .and() .stderr(assert_cli::Output::contains("foo-bar-foo")) .unwrap(); ``` Pros - More consistent with `with_env` - Can add support for accepting arrays - Still auto-complete / docs friendly - Still expandable to additional assertions without much duplication or losing out on good error reporting Cons - More verbose if you don't `use assert_cli::{Assert, Environment, Output}` Alternatives - Accept distinct predicates - e.g. `.stderr(assert_cli::Is::text("foo-bar-foo"))` - e.g. `.stderr(assert_cli::Is::not("foo-bar-foo"))` - Strange `text` function - More structs to `use` - Less auto-complete / docs friendly (lacks contextual discovery or whatever the UX term is) Fixes #70 BREAKING CHANGE: `.stdout().contains(text)` is now `.stdout(assert_cli::Output::contains(text)`, etc.
- Loading branch information