Are there conventions for function names when using Perl Test :: More?

Are there conventions for function names when using the Perl Test :: More or Test :: Simple modules?

I specifically ask a question about the names of the functions that are used to configure the test environment before the test and disrupt the environment after the successful completion of the test (s).

amuses

Rob

+3
source share
8 answers

I do not think there are such agreements.

The only way to do this is perhaps to use BEGIN / END blocks if resources will be used throughout the file.

, , - , / .. , , .

- ...

BEGIN {
   # If you want to set some global db setting/file setting/INC changes etc
}

# Tests functionality 1...
{
     # have fun .... 
}

# Tests functionality 2...
{
     # have more fun .... 
}

END {
   # Clean up the BEGIN changes
}

, perl... http://perlandmac.blogspot.com/2007/08/using-perl-testsimple-and-testmore.html

+3

XUnit, Test::Class. Test(setup) Test(teardown) , , , . ( , ) .

+4

.

perldocs, .

XUnit.

Jagmal, BEGIN END , , . , .. .t .

Test:: Most, , . .

. , BEGIN END, , , , .

,

Rob

+1

Test:: More , () Perl. , , Jagmal, , .

script. , ( unit test) , , .

+1

, , - Test:: More for Test:: Most

0

Perl . , , Perl script.

, , , .

, , .

, t/*. t CPAN. , , , .

0

If you can also take part in acceptance tests, such as Ruby Cucumber, take a look at this small example http://github.com/kesor/p5-cucumber , which uses Test :: More and the cucumber style of acceptance tests.

0
source

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


All Articles