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

Using snapshots for testing #7

Open
nyurik opened this issue Sep 10, 2024 · 0 comments
Open

Using snapshots for testing #7

nyurik opened this issue Sep 10, 2024 · 0 comments

Comments

@nyurik
Copy link

nyurik commented Sep 10, 2024

Hi, thx for maintaining this. I wonder if the insta snapshots can be used for testing?

#[test]
fn my_test() {
  let input: TokenStream = quote!( ... );
  let result = my_code_generator(input).unwrap();

  // running insta bless will update "" to the actual value, assuming result has Display
  assert_snapshot!(result, @"");
}

It seems syn crate uses exactly the same approach, but I have no idea how to get started with using it in my code. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant