Skip to content

"Sub" snapshots. #13

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

Merged
merged 5 commits into from
Sep 4, 2023
Merged

"Sub" snapshots. #13

merged 5 commits into from
Sep 4, 2023

Conversation

nedtwigg
Copy link
Member

If you run this test you'll get this failure:

image

The assertion is expecting a snapshot file like this

      ╔═ selfie ═╗
      root
      ╔═ selfie/leaf ═╗
      maple
      ╔═ [end of file] ═╗

but it's missing the selfie/leaf=maple part. If you open up UT_WithinMethodGC, it will look like this:

class UT_WithinMethodGC {
//    @Test fun selfie2() {
    @Test fun selfie() {
    expectSelfie("root").toMatchDisk()
    expectSelfie("maple").toMatchDisk("leaf")
  }
}

If you run that UT_ test file (as underTest) then you'll see that the problem is repeatable. Stick a breakpoint on the line

expectSelfie("maple").toMatchDisk("leaf")

and you should be able to walk through to the problem pretty well. I'll give a hint that the current cause is an off-by-one error when calculating a suffix. Maybe another problem pops up when that gets fixed, I dunno.

Base automatically changed from feat/undertest to main August 28, 2023 20:15
@nedtwigg
Copy link
Member Author

Sorry if I caused conflicts, had to move some things around in main. If you haven't started on this yet then it's exactly the same, except WithinMethodGC is now WithinMethodTestGC.

@jknack
Copy link
Collaborator

jknack commented Sep 3, 2023

@nedtwigg Hopefully I finally got it, please check my commit comments

@nedtwigg
Copy link
Member Author

nedtwigg commented Sep 3, 2023

Looks perfect, that's the suffix bug I expected. No fun to be stuck in debugger, but good tour of the system. The next ones should be more fun, and then writing the inplace literal system should be really fun I think!

Looks like it needs a spotlessApply to pass tests. Once CI is passing hit merge and start the next one.

Re: UT_ selfie/selfie2 I'm on mobile today and can't view code easily, but if it passes CI it's good with me.

@jknack
Copy link
Collaborator

jknack commented Sep 3, 2023

Thanks I missed the spotless run. I will fix soon today

@jknack jknack force-pushed the feat/gc-within-method branch from d953044 to 1e7589b Compare September 4, 2023 00:10
- The issue was an extra offset while looking for suffix: `leaf` vs `/leaf`
- The undertest-junit5/src/test/kotlin/undertest/junit5/UT_WithinMethodGCTest.kt got modified after test run. Probably want to revert the `selfie` `selfie2` change
- It was a simple bug, but very hard to debug. Still I like how his selfie lib is working, pretty good stuff
@jknack jknack force-pushed the feat/gc-within-method branch from 1e7589b to 07611c5 Compare September 4, 2023 00:16
- so spotless doesn't complain about bad formatting
@jknack jknack merged commit 837c2b4 into main Sep 4, 2023
@nedtwigg nedtwigg deleted the feat/gc-within-method branch September 9, 2023 23:22
nedtwigg added a commit that referenced this pull request Feb 27, 2024
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.

2 participants