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

Macro-less variants of expect and expect_file #32

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

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