Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

New module prototype - Test::Referenced

by Natanael (Acolyte)
on May 14, 2010 at 22:33 UTC ( #840075=perlquestion: print w/replies, xml ) Need Help??
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).

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:

  • is the package name sane?
  • should I contact/ask/confirm something, before uploading a module into Test::*?
  • are the function names sane?
  • maybe there is some very similar module, about which I'm not aware of, that does similar job?

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.


      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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://840075]
Approved by toolic
Front-paged by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-04-24 22:28 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (447 votes). Check out past polls.