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

How to compare multi-line strings with unpredictable values? #8

Open
dnephin opened this issue Aug 11, 2017 · 2 comments
Open

How to compare multi-line strings with unpredictable values? #8

dnephin opened this issue Aug 11, 2017 · 2 comments

Comments

@dnephin
Copy link
Member

dnephin commented Aug 11, 2017

Ex: The stdout of docker build includes ids that will change.

golden expects exact values, but maybe we could support some way of templating things so that it can assert the actual result matches a template/pattern. This could be in a different package, or just a different assertions (AssertPattern() or something).

@dnephin
Copy link
Member Author

dnephin commented Sep 23, 2017

I looked around for a library that could be used to parse this type of thing but I couldn't find anything that didn't just use regular expressions.

@dnephin
Copy link
Member Author

dnephin commented Nov 21, 2017

I went with this: https://github.com/docker/cli/pull/709/files, using a map of line -> check function. It seems to work well for this case.

@dnephin dnephin changed the title [golden] How to compare multi-line strings with unpredictable values? How to compare multi-line strings with unpredictable values? Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant