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

Fails on nameless doctest snapshot with value #252

Closed
GrandChaman opened this issue Jul 29, 2022 · 0 comments · Fixed by #253
Closed

Fails on nameless doctest snapshot with value #252

GrandChaman opened this issue Jul 29, 2022 · 0 comments · Fixed by #253
Labels
bug Something isn't working

Comments

@GrandChaman
Copy link

What happened?

insta throws the following error:

thread 'main' panicked at 'Cannot determine reliable names for snapshot in doctests.  Please use explicit names instead.'

when providing the snapshot in code directly, which shouldn't require the snapshot to be named.

Reproduction steps

Either:

/// Some doc test
///
/// ```rust
///     let some_string = "Coucou je suis un joli bug";
///
///     insta::assert_display_snapshot!(some_string, @"Coucou je suis un joli bug");
/// ```
pub fn some_function() {}

or

/// Some doc test
///
/// ```rust
///     let some_string = "Coucou je suis un joli bug";
///
///     insta::assert_debug_snapshot!(some_string, @"Coucou je suis un joli bug");
/// ```
pub fn some_function() {}

Insta Version

1.17.0

rustc Version

rustc 1.62.1 (e092d0b6b 2022-07-16)

What did you expect?

When writing an assert_display_snapshot/assert_debug_snapshot with a provided snapshot in code, the name should be optional. It shouldn't be panicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant