-
Couldn't load subscription status.
- Fork 12
#81: Implement ignoring of multiline strings and comments for //selfieonce #536
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
base: main
Are you sure you want to change the base?
Conversation
|
Here are some examples of how new implementation will handle These will be replaced:
These would be replaced before, but will not be replaced with PR version:
|
|
Wonderful, thanks! Out of curiosity, did you bump into a case where you had |
|
Hi @nedtwigg, thanks for the interest in the PR. I think Probably more likely end users might want to put it in the comments like so: /**
* This test suite heavily relies on selfie library
* for snapshot testing. For updating snapshots,
* put //selfieonce comment anywhere in the file and re-run test suite.
*/
class SomeTest {
...
} |
… //selfieonce Key changes: - Implement escaping rules for escaping multiline strings, block-style comments /**/, javadoc-style comments /***/ during //selfieonce replacement - Add comprehensive test suite in `RemoveSelfieOnceCommentTest` to verify correct behavior in various scenarios - Update one test case in `InteractiveTest`
e6ded20 to
c038b41
Compare
|
I saw that Ci was failing with spotless check, so I ran spotlessApply and force-pushed changes, hopefully it will be okay this time. |
|
Sorry this has sat for so long. To close the loop:
I plan to not merge this code but leave the PR open. I think Selfie will keep it's comment detection / fixing to be just the naive super simple logic it has now: selfie/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/CommentTracker.kt Lines 60 to 61 in 319a1b9
But if people bump into problems with this, I hope they share their experience and I am open to reconsidering. |
Key changes:
/**/, javadoc-style comments/***/during//selfieoncereplacementRemoveSelfieOnceCommentTestInteractiveTestThis implementation can actually work more efficiently by working entirely on
CharSequenceto avoid generating strings back and forth fromcom.diffplug.selfie.guts.Slice. But if I change receive/return types toCharSequence, it won't connect withSliceclass, because it expects to receiveString.Please don't freak out by huge diff, most of it are test cases to ensure there is no regression, and to illustrate what cases new functionality covers.