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

Better golden filenames #35

Merged
merged 5 commits into from
Mar 16, 2020
Merged

Conversation

travisbrown
Copy link
Member

This PR fixes three things.

@bastewart pointed out today that the synthetic golden filenames collide for generic types with different type parameters (e.g. List[Int] and List[String] would have the same name). He also noted that the regex used to match files and names breaks if you manually provide a name like "List[Int]".

  • I've changed the name inferrer thingy to include type parameters in the name. The default encoding turns MyTuple[MyList[Wub], MyList[MyList[Foo]]] into MyTuple_MyList_Wub_MyList_MyList_Foo. I don't particular care about the specifics here, but using underscores seems simple, likely not to cause problems across platforms, and doesn't collide with the hyphen used to set off the seed in the filename.

  • I've changed the first part of the regex (the comparing names part) to a simple call to startsWith, and then use a modified regex to pull out the seed and validate the rest of the name (which is a static format—no interpolation of possibly arbitrary user stuff).

  • Also for some reason (like my inability to work effectively with horrible types like Int) I originally reversed the order of the size and count parameters in one of ResourceFileGoldenCodecLaws's apply overloads. I changed them to be consistent with the other overloads. This is bincompat because Int. Hopefully nobody's actually used this overload (if they have they might get a surprise the next time they run their tests, but it should be easy enough to figure out what's up).

@travisbrown travisbrown merged commit 284510b into master Mar 16, 2020
@travisbrown travisbrown deleted the topic/better-golden-filenames branch August 26, 2021 10:19
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 this pull request may close these issues.

1 participant