Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inline block format also for strings of form "foo\n" #225

Merged
merged 1 commit into from Apr 27, 2022

Commits on Apr 25, 2022

  1. Use inline block format also for strings of form "foo\n"

    The generated inline strings for snapshots with a single trailing
    newline currently look something like this:
    
    ```
        insta::assert_snapshot!(stdout, @"foo
    ");
    ```
    
    The unindented line there is distracting. I think it looks neater with
    the block-style strings, like this:
    
    ```
        insta::assert_snapshot!(stdout, @###"
        foo
        "###);
    ```
    
    I suspect the reason it isn't currently generated like that is just an
    oversight caused by the fact that Rust's `str::lines()` returns a
    single line for that kind of strings. This patch fixes it by looking
    for `\n` characters instead.
    martinvonz committed Apr 25, 2022
    Configuration menu
    Copy the full SHA
    3666cfd View commit details
    Browse the repository at this point in the history