Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Config::Model::Tester:UseruContributed Perl DocConfig::Model::Tester::Setup(3)

NAME
       Config::Model::Tester::Setup - Common test setup	functions for
       Config::Model

VERSION
       version 4.006

SYNOPSIS
	# in t/some_test.t
	use warnings;
	use strict;

	use Config::Model::Tester::Setup qw/init_test setup_test_dir/;

	my ($model, $trace) = init_test();

	# pseudo root where config files are written by	config-model as	setup
	# by init_test
	my $wr_root = setup_test_dir();

DESCRIPTION
       This module provide 2 functions to setup	a test environment that	can be
       used in most test involving Config::Model.

FUNCTIONS
   init_test
       Scan test command line options and initialise a Config::Model object.

       Returns a list containing a Config::Model object, a boolean and a hash.
       The boolean is true if option "--trace" was used	on the command line.

       Default command options are:

       o   "--error": When set,	error handled by Config::Model::Exception
	   shows a strack trace	when dying.

       o   "--log": When set, Log::Log4perl uses the config from file
	   "~/.log4config-model" or the	default	config provided	by
	   Config::Model. By default, only Error level and above are shown.
	   Note	that log tests are disabled when this option is	set, so	you
	   may see a lot of harmless Warning messages during tests (which
	   depend on the tests to be run).  Experimental.

       More options can	be passed to "init_test" using option definitions like
       the one defined in Getopt::Long . The value of the command line options
       are returned in the 3rd returned	value.

       For instance, for a test	named "t/my_test.t" calling :

	 init_test('foo', 'bar=s')

       The test	file can be run	with:

	 perl t/my_test.t --foo	--bar=baz --log	--trace

       "init_test" returns:

	 ($model, 1, { foo => 1, bar =>	'baz', log => 1	, trace	=> 1, error => 0 })

   setup_test_dir
       Cleanup and create a test directory in "wr_root/test-script-name". For
       instance	this function creates directory	"wr_root/foo" for test
       "t/foo.t"

       Returns a Path::Tiny object of the test directory or a string if
       "setup_test_dir"	is called with "stringify => 1".

SEE ALSO
       o   Config::Model

       o   Test::More

AUTHOR
       Dominique Dumont

COPYRIGHT AND LICENSE
       This software is	Copyright (c) 2013-2020	by Dominique Dumont.

       This is free software, licensed under:

	 The GNU Lesser	General	Public License,	Version	2.1, February 1999

perl v5.32.0			  2020-08-14   Config::Model::Tester::Setup(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | FUNCTIONS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Config::Model::Tester::Setup&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help