-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
expand: fix sequential '\' in double quote literals #1107
expand: fix sequential '\' in double quote literals #1107
Conversation
Thanks! I actually avoid unit tests where possible, and instead test the exposed API. In this case I would add integration tests in the interpreter, for example adding to these around line 400 in interp_test.go:
I know that means there isn't test coverage in the same package, but I think proper coverage across the module is still fine. And, ultimately, most of these bugs in the expand package only matter for users of the interp package. |
And avoiding unit tests also means that you don't need to add one more function to test. |
For clarity, do you prefer to keep the logic inlined? My default is to split out what I would consider to be tangential logic because I think it helps readability, but you're the maintainer. |
Yes, please keep the code where it was - the func isn't particularly large or very indented, so I don't think it requires splitting up just yet. |
Use interp_test instead of expand_test
Function is inlined once again, and the (in my opinion) essential test cases have been added to the interp_test.go test cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! The change is subtle but I do see how my previous logic was wrong with repeated backslashes, as rather than treating them like escape pairs, I would keep on skipping over all of them.
There was a minor gofmt issue which I fixed. I will squash-merge, as I prefer to keep the git history tidy. For future PRs, feel free to squash into a single commit yourself with a good commit message, and I'll merge as-is. |
Sounds good! |
(as usual got sidetracked waiting for CI to pass, merging now) |
Fix for #1106