Skip to content
This repository has been archived by the owner on Dec 29, 2021. It is now read-only.

WIP: Free fns for Output constructors and add prelude #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 28, 2017

  1. 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.
    epage committed Oct 28, 2017
    Configuration menu
    Copy the full SHA
    063b3ce View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2017

  1. Free fns for Output constructors and add prelude

    Originally based on #74
    killercup committed Oct 29, 2017
    Configuration menu
    Copy the full SHA
    491d648 View commit details
    Browse the repository at this point in the history