How to check modules / scripts that output / modify files?

I have a couple of modules ( DZP :: Catalyst and DZP :: OurPkgVersion ), both of which are related to writing files to disk. I'm not sure how to test them, are there any good strategies for testing files written to disk? anywhere where I could read it?

+3
source share
2 answers

Well, in this particular case ( Dist :: Zilla plugins), you will want to use Dist :: Zilla :: Tester . He takes care of a large part of the grumbling work on creating a temporary directory, filling it with files and then cleaning it up. For example, see tests from my DZP :: CJM or tests from Dist :: Zilla directly , especially the plugin directory .

Update: Dist :: Zilla 4.200002 introduces the Test :: DZil module , which adds some useful features useful for testing plugins. You probably want to use it instead of using Dist :: Zilla :: Tester directly.

+3
source

, :

  • , 100% - - (, / / / ).

  • , 100% , . / .

  • , , , , , .

  • ,

    • , , , , , .

    • ,

    • tar-balled ( , , ).

      tarballs (, "expected_results" , script.

      tarball, > 1 .

  • :

    • " " ( )

    • temp; .

    • ( )

    • ( ) .

    • ( )

    • "temp expected results" ( )

    • tarball test_results temp ,

    • , tarball temp tarball.

    • -diff "temp expected results" temp directory temp " " (, , 100% 100% , Perl diff system().

, "Test:: FileGenerator", , .

+3

Source: https://habr.com/ru/post/1757770/


All Articles