i would like to test a little program in perl .cgi
this program is at this url:
https://perlmaven.com/testing-perl-cgi
this program is a general test and he say:
"it is enough to show how to test any CGI-script"
then i copy/paste the 2 cgi in the same directory and try the command line:
prove cgi.t
normally all successfull
the error is:
Failed test 'GET'
# at cgi.t line 20.
# ''
# doesn't match '(?^:<tr><td>request_method</td><td>GET</td></tr>)'
# Failed test 'name'
# at cgi.t line 21.
# ''
# doesn't match '(?^:<tr><td>name</td><td>foo</td></tr>)'
# Failed test 'email'
# at cgi.t line 22.
# ''
# doesn't match '(?^:<tr><td>email</td><td>bar\@corp.com</td></tr>)'
# Failed test 'stderr is empty'
# at cgi.t line 23.
# got: 'Can't exec "./cgi.pl": Permission denied at cgi.t line 17.
# '
# expected: ''
# Failed test 'exit code is 0'
# at cgi.t line 24.
# got: '-1'
# expected: '0'
# Looks like you failed 5 tests of 5.
cgi.t .. 1/2
# Failed test 'get'
# at cgi.t line 25.
# Failed test 'POST'
# at cgi.t line 43.
# ''
# doesn't match '(?^:<tr><td>request_method</td><td>POST</td></tr>)'
# Failed test 'language'
# at cgi.t line 44.
# ''
# doesn't match '(?^:<tr><td>language</td><td>Perl</td></tr>)'
# Failed test 'creator'
# at cgi.t line 45.
# ''
# doesn't match '(?^:<tr><td>creator</td><td>TimToady</td></tr>)'
# Failed test 'stderr is empty'
# at cgi.t line 46.
# got: 'sh: ./cgi.pl: Permission denied
# '
# expected: ''
# Failed test 'exit code is 0'
# at cgi.t line 47.
# got: '32256'
# expected: '0'
# Looks like you failed 5 tests of 5.
# Failed test 'post'
# at cgi.t line 48.
# Looks like you failed 2 tests of 2.
cgi.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests
Test Summary Report
-------------------
cgi.t (Wstat: 512 Tests: 2 Failed: 2)
Failed tests: 1-2
Non-zero exit status: 2
Files=1, Tests=2, 1 wallclock secs ( 0.12 usr 0.01 sys + 0.44 cusr 0.06 csys = 0.63 CPU)
Result: FAIL
Thanks in advance,
Ornot
Aucun commentaire:
Enregistrer un commentaire