pulldown-cmark-to-cmark icon indicating copy to clipboard operation
pulldown-cmark-to-cmark copied to clipboard

Turn `stupicat` tests into proper Rust tests

Open badboy opened this issue 5 years ago • 4 comments

What do you think about turning the tests that are currently done using the stupicat example into proper Rust tests?

We can have a tests/roundtrip.rs or similar that consumes the fixtures, runs against the API and checks the output. That way a simple cargo test really runs all the required tests.

badboy avatar May 13 '20 10:05 badboy

I like the proposition! The reason for doing it that way was my convenience only, but doing it that way might not be the most maintainable thing to do for the project.

A benefit of doing it that way was the visual diffing, and I wonder if 'insta' could be useful here for snapshot testing.

If there is no visual way of testing, this might be a good opportunity to split up the big input file into smaller chunks to make clearer what is important there.

Byron avatar May 13 '20 11:05 Byron

Maybe with things like pretty-assertions or directly using a diff crate. I play around and see what works with not too much overhead.

badboy avatar May 13 '20 11:05 badboy

👋 I'd be keen to add some insta tests. I'm looking to use pulldown-cmark and pulldown-cmark-to-cmark for a side project so this would be a useful contribution 💜

felipesere avatar Nov 29 '21 11:11 felipesere

By all means, please give it a shot. I wonder what the strategy would be. Is it pulling parts of the stupicat example out into insta so that the individual diffs are more maintainable?

Note that by now, we also are running the entire common mark spec without about 2/3 succeeding. All tests are generated, and maybe insta even has a place there to make the individual tests more easily viewable.

In any case, I'd prefer it if these insta tests aren't overlapping with what's there, ideally with bolstering the spec based tests while reducing stupicat ones if they aren't adding anything over the spec tests.

Byron avatar Nov 29 '21 23:11 Byron