tobyink / p5-match-simple

Perl 5 distribution match-simple; see homepage for downloads and documentation.
https://metacpan.org/release/match-simple
4 stars 3 forks source link

Test PP even if XS available #4

Open dmacks opened 1 year ago

dmacks commented 1 year ago

When running the self-test suite of match-simple-0.012 without match::simple::XS installed, I get:

t/02simple.t .. # implementation: PP

whereas if I do have m-s-XS installed:

t/02simple.t .. # implementation: XS

So it tests the default mode, and on my platform I can see it does find the ::XS backend, and then successfully tests it. However, this leaves the PP mode, implemented within match::test itself, un-tested. And if ::XS is not available, simply "PP" doesn't help me recognize that there is any other option or that the optional ::XS loader isn't being tested. And all of this is also somewhat at the whim of my local shell env. The result is that the test is not well-controlled or highly reproducible on live platforms. A more controlled and robust way would be to replace 02simple.t with:

First, 02simple-pp.t, a variant of it that always tests the PP code by setting the MATCH_SIMPLE_IMPLEMENTATION=PP env variable.

Second, 02simple-xs.t, a variant of it that clears that env variable, and throws a skip if the ::XS back-end is not available.

Let me know if it would be useful for me to hack something together as a PR.

tobyink commented 1 year ago

Yeah, I think that would be a worthwhile change.