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

.Contains()-type functionality? #27

Closed
danawoodman opened this issue Dec 24, 2019 · 1 comment · Fixed by #41
Closed

.Contains()-type functionality? #27

danawoodman opened this issue Dec 24, 2019 · 1 comment · Fixed by #41

Comments

@danawoodman
Copy link
Contributor

Would it be possible to have a .Contains() method that would check just part of the golden file? I have a golden file where some parts will change (like generic help text from a CLI) and all I really want to check for is "success" or similar.

I know that means its not really using the golden file but it would make the test less fragile.

Thoughts?

@gtrevg
Copy link
Contributor

gtrevg commented Apr 5, 2020

@danawoodman I think maybe the right design would be to add a WithCompareFn option that allows you to pass in your own compare function. The comparison lines

would then call the compare function. That way, you could override how it does a comparison between the actualData and the expectedData (which could just do a substring comparison in your case).

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

Successfully merging a pull request may close this issue.

2 participants