6 ms·
This is a cool idea. I wish something like this existed for C#.
by o_nate 7mo ago
This is a cool idea. I wish something like this existed for C#.
- PretzelPirate 7mo agoAn Agentic coding tool like Github Copilot will do this for you.
- Smaug123 7mo agoThe thing that most surprises me is that IDEs don't have a standard protocol for this, so you basically need a custom test runner if you want one-click "this snapshot failed; update it" self-modifying tests. I wrote WoofWare.Expect for F#, which has an "update my snapshots on disk" mode, but you can't go straight from test failure to snapshot update without a fresh test run, even though I'm literally outputting a patience diff that an IDE could apply if it knew how. Worse, e.g. Rider is really bad at knowing when files have changed underneath it, so you have to manually tell it to reload the files after running the update or else you clobber them in the editor.
- RhysU 7mo ago> ...if you want one-click "this snapshot failed; update it" self-modifying tests. I am envisioning the PR arguments now when the first instinct of the junior developer is to clobber the prior gold standard outputs. Especially lovely when testing floating point functionality using tests with tolerances. Some things should be hatefully slow so one's brain has sufficient chance to subconsciously mull over "what if I am wrong?"
- legulere 7mo agoBut there is: https://www.meziantou.net/inline-snapshot-testing-in-dotnet.htm https://www.meziantou.net/inline-snapshot-testing-in-dotnet....