Pod-Site
view release on metacpan or search on metacpan
3536373839404142434445464748495051525354555657585960616263
main_module
=>
undef
,
versioned_title
=>
undef
,
replace_css
=>
undef
,
replace_js
=>
undef
,
label
=>
undef
,
man
=>
undef
,
help
=>
undef
,
);
DEFAULTS: {
local
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
,
$mod_root
);
is_deeply
$CLASS
->_config, \
%config
,
'Should have default config'
;
}
ERRS: {
my
$mock
= Test::MockModule->new(
$CLASS
);
my
@args
;
$mock
->mock(
_pod2usage
=>
sub
{
@args
=
@_
} );
local
@ARGV
= (
$mod_root
);
ok
$CLASS
->_config,
'configure with no options'
;
is_deeply \
@args
, [
$CLASS
,
'-message'
,
'Missing required --doc-root and --base-uri options'
,
],
'Should have been helped'
;
@ARGV
= (
'--doc-root'
,
$doc_root
,
$mod_root
);
ok
$CLASS
->_config,
'configure with no --base_uri'
;
is_deeply \
@args
, [
$CLASS
,
737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
);
ok
$CLASS
->_config,
'configure with no module root'
;
is_deeply \
@args
, [
$CLASS
,
'-message'
,
'Missing path to module root'
,
],
'Should have been helped again'
;
}
MULTIPLES: {
local
@ARGV
= (
'--doc-root'
=>
$doc_root
,
'--base-uri'
=>
$base_uri
,
'--base-uri'
=>
'/whatever'
,
$mod_root
,
'/another/root'
);
local
$config
{base_uri} = [
$base_uri
,
'/whatever/'
];
local
$config
{module_roots} = [
$mod_root
,
'/another/root'
];
is_deeply
$CLASS
->_config, \
%config
,
'Allow multiple --base-uri'
;
}
HELP: {
my
$mock
= Test::MockModule->new(
$CLASS
);
my
@args
;
$mock
->mock(
_pod2usage
=>
sub
{
@args
=
@_
} );
local
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
,
$mod_root
,
'--help'
);
ok
$CLASS
->_config,
'Ask for help'
;
is_deeply \
@args
, [
$CLASS
,
'-exitval'
, 0 ],
'Should have been helped'
;
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
,
$mod_root
,
'-h'
);
ok
$CLASS
->_config,
'Ask for help short'
;
is_deeply \
@args
, [
$CLASS
,
'-exitval'
, 0 ],
'Should have been helped again'
;
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
,
$mod_root
,
'--man'
);
ok
$CLASS
->_config,
'Ask for man'
;
is_deeply \
@args
, [
$CLASS
,
'-sections'
,
'.+'
,
'-exitval'
, 0 ],
'Should have been manned'
;
@ARGV
= (
'--doc-root'
,
$doc_root
,
'--base-uri'
,
$base_uri
,
$mod_root
,
'-M'
);
ok
$CLASS
->_config,
'Ask for man short'
;
is_deeply \
@args
, [
$CLASS
,
'-sections'
,
'.+'
,
'-exitval'
, 0 ],
'Should have been manned again'
;
}
LOTS: {
local
@ARGV
= (
'--doc-root'
=>
$doc_root
,
'--base-uri'
=>
$base_uri
,
'--favicon-uri'
=>
'my.icon'
,
'--sample-module'
=>
'lib/Hello.pm'
,
'--main-module'
=>
'lib/Bye.pm'
,
'--index-file'
=>
'default.htm'
,
'--css-path'
=>
'/some/file.css'
,
'--js-path'
=>
'/some/file.js'
,
'--name'
=>
'Eat me'
,
'--label'
=>
'API Browser'
,
147148149150151152153154155156157158159160161162163164165166167
label
=>
'API Browser'
,
versioned_title
=> 1,
replace_css
=> 1,
replace_js
=> 1,
man
=>
undef
,
help
=>
undef
,
},
'Lots of opts should work'
;
}
SHORT: {
local
@ARGV
= (
'-d'
=>
$doc_root
,
'-u'
=>
$base_uri
,
'-s'
=>
'lib/Hello.pm'
,
'-m'
=>
'lib/Bye.pm'
,
'-i'
=>
'default.htm'
,
'-c'
=>
'/some/file.css'
,
'-j'
=>
'/some/file.js'
,
'-n'
=>
'Eat me'
,
'-l'
=>
'API Browser'
,
'-t'
,
186187188189190191192193194195196197198199200201202203204205206
versioned_title
=> 1,
replace_css
=>
undef
,
replace_js
=>
undef
,
man
=>
undef
,
help
=>
undef
,
},
'Lots of short opts should work'
;
}
NEGATED: {
local
@ARGV
= (
'--doc-root'
=>
$doc_root
,
'--base-uri'
=>
$base_uri
,
'--no-versioned-title'
,
$mod_root
,
);
is_deeply
$CLASS
->_config, {
%config
,
versioned_title
=> 0,
},
'Negated opts should work'
;
}
( run in 0.230 second using v1.01-cache-2.11-cpan-55f5a4728d2 )