http://www.perlmonks.org?node_id=840075

Natanael has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks!

I'm working on a new package/module, called Test::Referenced, that I intend to upload to CPAN once finished. It's based on an old idea, that has proven to be very useful to me.

Test::Referenced - Test against reference data stored in file(s).

Synopsis:
use Test::Referenced; is_referenced_ok( complex_data(), "complex data" ); is_referenced_in_file( data_structure(), "complex data test", "data_structure" );

Full POD is available here: Test-Referenced.txt

I never uploaded anything in Test::* namespace, thus I want to ask some questions before doing so:

Thank You for any tips in this matter!

Replies are listed 'Best First'.
Re: New module prototype - Test::Referenced
by jettero (Monsignor) on May 14, 2010 at 23:10 UTC
    I might try to get the word File in the package name somewhere... It's probably something I would try to use if I noticed it.

    -Paul

      OK, Test::FileReferenced seems to describe the functionality pretty well :)

      Thank You for the hint!
Re: New module prototype - Test::Referenced
by ctilmes (Vicar) on May 15, 2010 at 02:01 UTC
      Thank You for the hint, I was not aware of this module!

      It should ease defining dependencies in Build.PL too :)
Re: New module prototype - Test::Referenced
by SilasTheMonk (Chaplain) on May 15, 2010 at 17:07 UTC
    This reminds me of two modules: Test::Deep and Test::Regression. The former allows the module author to test complex data structures. The latter, which I have some interest in, allows a module author to compare output against previously generated output and regenerate the reference files if necessary. I think if built upon the two you would have exactly what you are trying to build.
      I must say, that I did not know Test::Regression, till now, and yes, it is in some ways similar to my idea.

      For the moment, I'm using is_deeply() from Test::More, but it could be interesting to implement a set of functions similar to ones from Test::Deep, but which would load their reference from file, instead of having it given in test. It could be an almost-drop-in replacement :-D

      Also, I like the idea behind $ENV{TEST_REGRESSION_GEN}, and I'll implement an equivalent.

      Thank You for the valuable feedback :)
        Why don't you go one further and actually use Test::Deep and Test::Regression in your implementation. I am sure both authors would appreciate any feedback generated and your module would have that much less code in it. It would make sense then to rename it Test::Deep::Regression or some variant thereof.