403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.144.31.86
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/Template::Test.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
.\" ========================================================================
.\"
.IX Title "Template::Test 3"
.TH Template::Test 3 "2014-04-24" "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"
Template::Test \- Module for automating TT2 test scripts
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use Template::Test;
\&   
\&    $Template::Test::DEBUG = 0;   # set this true to see each test running
\&    $Template::Test::EXTRA = 2;   # 2 extra tests follow test_expect()...
\&    
\&    # ok() can be called any number of times before test_expect
\&    ok( $true_or_false )
\&    
\&    # test_expect() splits $input into individual tests, processes each 
\&    # and compares generated output against expected output
\&    test_expect($input, $template, \e%replace );
\&    
\&    # $input is text or filehandle (e.g. DATA section after _\|_END_\|_)
\&    test_expect( $text );
\&    test_expect( \e*DATA );
\&    
\&    # $template is a Template object or configuration hash
\&    my $template_cfg = { ... };
\&    test_expect( $input, $template_cfg );
\&    my $template_obj = Template\->new($template_cfg);
\&    test_expect( $input, $template_obj );
\&    
\&    # $replace is a hash reference of template variables
\&    my $replace = {
\&        a => \*(Aqalpha\*(Aq,
\&        b => \*(Aqbravo\*(Aq
\&    };
\&    test_expect( $input, $template, $replace );
\&    
\&    # ok() called after test_expect should be declared in $EXTRA (2)
\&    ok( $true_or_false )   
\&    ok( $true_or_false )
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \f(CW\*(C`Template::Test\*(C'\fR module defines the \fItest_expect()\fR and other related
subroutines which can be used to automate test scripts for the
Template Toolkit.  See the numerous tests in the \fIt\fR sub-directory of
the distribution for examples of use.
.SH "PACKAGE SUBROUTINES"
.IX Header "PACKAGE SUBROUTINES"
.SS "\fItext_expect()\fP"
.IX Subsection "text_expect()"
The \f(CW\*(C`test_expect()\*(C'\fR subroutine splits an input document into a number
of separate tests, processes each one using the Template Toolkit and
then compares the generated output against an expected output, also
specified in the input document.  It generates the familiar 
\&\f(CW\*(C`ok\*(C'\fR/\f(CW\*(C`not ok\*(C'\fR output compatible with \f(CW\*(C`Test::Harness\*(C'\fR.
.PP
The test input should be specified as a text string or a reference to
a filehandle (e.g. \f(CW\*(C`GLOB\*(C'\fR or \f(CW\*(C`IO::Handle\*(C'\fR) from which it can be read.  In 
particular, this allows the test input to be placed after the \f(CW\*(C`_\|_END_\|_\*(C'\fR
marker and read via the \f(CW\*(C`DATA\*(C'\fR filehandle.
.PP
.Vb 1
\&    use Template::Test;
\&    
\&    test_expect(\e*DATA);
\&    
\&    _\|_END_\|_
\&    # this is the first test (this is a comment)
\&    \-\- test \-\-
\&    blah blah blah [% foo %]
\&    \-\- expect \-\-
\&    blah blah blah value_of_foo
\&    
\&    # here\*(Aqs the second test (no surprise, so is this)
\&    \-\- test \-\-
\&    more blah blah [% bar %]
\&    \-\- expect \-\-
\&    more blah blah value_of_bar
.Ve
.PP
Blank lines between test sections are generally ignored.  Any line starting
with \f(CW\*(C`#\*(C'\fR is treated as a comment and is ignored.
.PP
The second and third parameters to \f(CW\*(C`test_expect()\*(C'\fR are optional.  The second
may be either a reference to a Template object which should be used to 
process the template fragments, or a reference to a hash array containing
configuration values which should be used to instantiate a new Template
object.
.PP
.Vb 6
\&    # pass reference to config hash
\&    my $config = {
\&        INCLUDE_PATH => \*(Aq/here/there:/every/where\*(Aq,
\&        POST_CHOMP   => 1,
\&    };
\&    test_expect(\e*DATA, $config);
\&    
\&    # or create Template object explicitly
\&    my $template = Template\->new($config);
\&    test_expect(\e*DATA, $template);
.Ve
.PP
The third parameter may be used to reference a hash array of template
variable which should be defined when processing the tests.  This is
passed to the Template \fIprocess()\fR method.
.PP
.Vb 4
\&    my $replace = {
\&        a => \*(Aqalpha\*(Aq,
\&        b => \*(Aqbravo\*(Aq,
\&    };
\&    
\&    test_expect(\e*DATA, $config, $replace);
.Ve
.PP
The second parameter may be left undefined to specify a default Template
configuration.
.PP
.Vb 1
\&    test_expect(\e*DATA, undef, $replace);
.Ve
.PP
For testing the output of different Template configurations, a
reference to a list of named Template objects also may be passed as
the second parameter.
.PP
.Vb 3
\&    my $tt1 = Template\->new({ ... });
\&    my $tt2 = Template\->new({ ... });
\&    my @tts = [ one => $tt1, two => $tt1 ];
.Ve
.PP
The first object in the list is used by default.  Other objects may be 
switched in with a '\f(CW\*(C`\-\- use $name \-\-\*(C'\fR' marker.  This should immediately 
follow a '\f(CW\*(C`\-\- test \-\-\*(C'\fR' line.  That object will then be used for the rest 
of the test, or until a different object is selected.
.PP
.Vb 5
\&    \-\- test \-\-
\&    \-\- use one \-\-
\&    [% blah %]
\&    \-\- expect \-\-
\&    blah, blah
\&    
\&    \-\- test \-\-
\&    still using one...
\&    \-\- expect \-\-
\&    ...
\&    
\&    \-\- test \-\-
\&    \-\- use two \-\-
\&    [% blah %]
\&    \-\- expect \-\-
\&    blah, blah, more blah
.Ve
.PP
The \f(CW\*(C`test_expect()\*(C'\fR sub counts the number of tests, and then calls \fIntests()\fR 
to generate the familiar "\f(CW\*(C`1..$ntests\en\*(C'\fR" test harness line.  Each 
test defined generates two test numbers.  The first indicates 
that the input was processed without error, and the second that the 
output matches that expected.
.PP
Additional test may be run before \f(CW\*(C`test_expect()\*(C'\fR by calling \fIok()\fR. These
test results are cached until \fIntests()\fR is called and the final number of
tests can be calculated. Then, the "\f(CW\*(C`1..$ntests\*(C'\fR\*(L" line is output, along with
\&\*(R"\f(CW\*(C`ok $n\*(C'\fR\*(L" / \*(R"\f(CW\*(C`not ok $n\*(C'\fR" lines for each of the cached test result.
Subsequent calls to \fIok()\fR then generate an output line immediately.
.PP
.Vb 2
\&    my $something = SomeObject\->new();
\&    ok( $something );
\&    
\&    my $other = AnotherThing\->new();
\&    ok( $other );
\&    
\&    test_expect(\e*DATA);
.Ve
.PP
If any tests are to follow after \f(CW\*(C`test_expect()\*(C'\fR is called then these 
should be pre-declared by setting the \f(CW$EXTRA\fR package variable.  This
value (default: \f(CW0\fR) is added to the grand total calculated by \fIntests()\fR.
The results of the additional tests are also registered by calling \fIok()\fR.
.PP
.Vb 1
\&    $Template::Test::EXTRA = 2;
\&    
\&    # can call ok() any number of times before test_expect()
\&    ok( $did_that_work );             
\&    ok( $make_sure );
\&    ok( $dead_certain ); 
\&    
\&    # <some> number of tests...
\&    test_expect(\e*DATA, $config, $replace);
\&    
\&    # here\*(Aqs those $EXTRA tests
\&    ok( defined $some_result && ref $some_result eq \*(AqARRAY\*(Aq );
\&    ok( $some_result\->[0] eq \*(Aqsome expected value\*(Aq );
.Ve
.PP
If you don't want to call \f(CW\*(C`test_expect()\*(C'\fR at all then you can call
\&\f(CW\*(C`ntests($n)\*(C'\fR to declare the number of tests and generate the test 
header line.  After that, simply call \fIok()\fR for each test passing 
a true or false values to indicate that the test passed or failed.
.PP
.Vb 3
\&    ntests(2);
\&    ok(1);
\&    ok(0);
.Ve
.PP
If you're really lazy, you can just call \fIok()\fR and not bother declaring
the number of tests at all.  All tests results will be cached until the
end of the script and then printed in one go before the program exits.
.PP
.Vb 2
\&    ok( $x );
\&    ok( $y );
.Ve
.PP
You can identify only a specific part of the input file for testing
using the '\f(CW\*(C`\-\- start \-\-\*(C'\fR' and '\f(CW\*(C`\-\- stop \-\-\*(C'\fR' markers.  Anything before the 
first '\f(CW\*(C`\-\- start \-\-\*(C'\fR' is ignored, along with anything after the next 
\&'\f(CW\*(C`\-\- stop \-\-\*(C'\fR' marker.
.PP
.Vb 4
\&    \-\- test \-\-
\&    this is test 1 (not performed)
\&    \-\- expect \-\-
\&    this is test 1 (not performed)
\&    
\&    \-\- start \-\-
\&    
\&    \-\- test \-\-
\&    this is test 2
\&    \-\- expect \-\-
\&    this is test 2
\&        
\&    \-\- stop \-\-
\&    
\&    ...
.Ve
.SS "\fIntests()\fP"
.IX Subsection "ntests()"
Subroutine used to specify how many tests you're expecting to run.
.SS "ok($test)"
.IX Subsection "ok($test)"
Generates an "\f(CW\*(C`ok $n\*(C'\fR\*(L" or \*(R"\f(CW\*(C`not ok $n\*(C'\fR" message if \f(CW$test\fR is true or false.
.SS "not_ok($test)"
.IX Subsection "not_ok($test)"
The logical inverse of \fIok()\fR. Prints an "\f(CW\*(C`ok $n\*(C'\fR" message is \f(CW$test\fR is
\&\fIfalse\fR and vice-versa.
.SS "\fIcallsign()\fP"
.IX Subsection "callsign()"
For historical reasons and general utility, the module also defines a
\&\f(CW\*(C`callsign()\*(C'\fR subroutine which returns a hash mapping the letters \f(CW\*(C`a\*(C'\fR
to \f(CW\*(C`z\*(C'\fR to their phonetic alphabet equivalent (e.g. radio callsigns). 
This is used by many of the test scripts as a known source of variable values.
.PP
.Vb 1
\&    test_expect(\e*DATA, $config, callsign());
.Ve
.SS "\fIbanner()\fP"
.IX Subsection "banner()"
This subroutine prints a simple banner including any text passed as parameters.
The \f(CW$DEBUG\fR variable must be set for it to generate any output.
.PP
.Vb 1
\&    banner(\*(AqTesting something\-or\-other\*(Aq);
.Ve
.PP
example output:
.PP
.Vb 3
\&    #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&    # Testing something\-or\-other (27 tests completed)
\&    #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.Ve
.SH "PACKAGE VARIABLES"
.IX Header "PACKAGE VARIABLES"
.ie n .SS "$DEBUG"
.el .SS "\f(CW$DEBUG\fP"
.IX Subsection "$DEBUG"
The \f(CW$DEBUG\fR package variable can be set to enable debugging mode.
.ie n .SS "$PRESERVE"
.el .SS "\f(CW$PRESERVE\fP"
.IX Subsection "$PRESERVE"
The \f(CW$PRESERVE\fR package variable can be set to stop the \fItest_expect()\fR
from converting newlines in the output and expected output into
the literal strings '\en'.
.SH "HISTORY"
.IX Header "HISTORY"
This module started its butt-ugly life as the \f(CW\*(C`t/texpect.pl\*(C'\fR script.  It
was cleaned up to became the \f(CW\*(C`Template::Test\*(C'\fR module some time around
version 0.29.  It underwent further cosmetic surgery for version 2.00
but still retains some remarkable rear-end resemblances.
.PP
Since then the \f(CW\*(C`Test::More\*(C'\fR and related modules have appeared on \s-1CPAN\s0
making this module mostly, but not entirely, redundant.
.ie n .SH "BUGS / KNOWN ""FEATURES"""
.el .SH "BUGS / KNOWN ``FEATURES''"
.IX Header "BUGS / KNOWN FEATURES"
Imports all methods by default.  This is generally a Bad Thing, but
this module is only used in test scripts (i.e. at build time) so a) we
don't really care and b) it saves typing.
.PP
The line splitter may be a bit dumb, especially if it sees lines like
\&\f(CW\*(C`\-\- this \-\-\*(C'\fR that aren't supposed to be special markers.  So don't do that.
.SH "AUTHOR"
.IX Header "AUTHOR"
Andy Wardley <abw@wardley.org> <http://wardley.org/>
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (C) 1996\-2007 Andy Wardley.  All Rights Reserved.
.PP
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Template

Youez - 2016 - github.com/yon3zu
LinuXploit