Skip to content

Conversation

jeremyBanks
Copy link

@jeremyBanks jeremyBanks commented Jul 5, 2022

Implements the macro-less variants of expect and expect_file using #[track_caller] as described in #15.

The compatibility concern with other functions using #[track_caller] raised in #15 (comment) is noted in the documentation. This isn't entirely a disadvantage; users can write certain wrapper functions with #[track_caller] like they might previously have written wrapper macros:

#[track_caller]
fn assert_debug_eq(expected: impl expect_test::ExpectedData, actual: impl core::fmt::Debug) {
    expect_test::expect(expected).assert_eq(&format!("{actual:?}"));
}

This requires bumping the MSRV, but only by one release (1.45.0 to 1.46.0).

@jeremyBanks jeremyBanks changed the title Macro-less version of expect_file Macro-less version of expect and expect_file Jul 5, 2022
@jeremyBanks jeremyBanks changed the title Macro-less version of expect and expect_file Macro-less variants of expect and expect_file Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant