Skip to content

expect! test fails after update #55

Description

@lijunchen

My env:

$ rustc --version                
rustc 1.86.0 (05f9846f8 2025-03-31)
$ cat Cargo.toml         
...
[dev-dependencies]
expect-test = "1.5.1"

Here is a mini test case to reproduce:

#[test]
fn expect_test_bug() {
    use expect_test::expect;
    expect![].assert_eq("X\n    Y\n    \nZ");
}

After run

$ env UPDATE_EXPECT=1 cargo test

This test block will be updated to

#[test]
fn expect_test_bug() {
    use expect_test::expect;
    expect![[r#"
        X
            Y
    
        Z"#]].assert_eq("X\n    Y\n    \nZ");
}

Then run cargo test, it fails because missing four spaces between Y and Z in Expect

$ cargo test
Expect:
----
X
    Y

Z
----

Actual:
----
X
    Y
    
Z
----

Diff:
----
X
    Y
    
Z
----

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions