[libcgi-test-perl] 15/24: More tests passing
Axel Beckert
abe at deuxchevaux.org
Mon Jan 11 00:38:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to annotated tag 0.50
in repository libcgi-test-perl.
commit 9c2809b5f9fecf93f8e0543c563f84b0d2e55700
Author: Alex Tokarev <nohuhu at nohuhu.org>
Date: Thu Sep 4 21:35:09 2014 -0700
More tests passing
---
t/03_get.t | 79 ++++++++++++++++++++------------------------------------------
1 file changed, 25 insertions(+), 54 deletions(-)
diff --git a/t/03_get.t b/t/03_get.t
index 842a6e4..b95c903 100644
--- a/t/03_get.t
+++ b/t/03_get.t
@@ -1,81 +1,52 @@
-#
-# $Id: get.t,v 1.2 2003/09/29 11:00:50 mshiltonj Exp $
-#
-# Copyright (c) 2001, Raphael Manfredi
-#
-# You may redistribute only under the terms of the Artistic License,
-# as specified in the README file that comes with the distribution.
-#
-# HISTORY
-# $Log: get.t,v $
-# Revision 1.2 2003/09/29 11:00:50 mshiltonj
-# CGI::Test has changed ownership. The new owner is Steven Hilton
-# <mshiltonj at mshiltonj.com>. Many thanks to Raphael Manfredi
-# and Steve Fink.
-#
-# CGI::Test is now hosted as a SourceForge project. It is located
-# at <http://cgi-test.sourceforge.net>.
-#
-# POD updated to reflect the above.
-#
-# make() method on various objects has been deprecated, and has been
-# replaced by more conventional (for me, at least) new() method.
-# Support for make() may be removed in a later release.
-#
-# Entire codebase reformatted using perltidy
-# Go to <http://perltidy.sourceforge.net/> to see how neat it is.
-#
-# Self-referential object variable name standardized to '$this'
-# throughout code.
-#
-# Revision 1.1.1.1 2003/09/23 09:47:26 mshiltonj
-# Initial Import
-#
-# Revision 0.1 2001/03/31 10:54:03 ram
-# Baseline for first Alpha release.
-#
-# $EndLog$
-#
+use Test::More tests => 14;
use CGI::Test;
-print "1..13\n";
+use constant WINDOWS => eval { $^O =~ /Win32|cygwin/ };
my $BASE = "http://server:18/cgi-bin";
+my $SCRIPT = WINDOWS ? "getform.bat" : "getform";
my $ct = CGI::Test->new(
-base_url => $BASE,
-cgi_dir => "t/cgi",
);
-ok 1, defined $ct;
+ok defined $ct, "Got CGI::Test object";
+isa_ok $ct, 'CGI::Test', 'isa';
-my $page = $ct->GET("$BASE/getform");
-ok 2, !$page->is_error;
+my $page = $ct->GET("$BASE/$SCRIPT");
+
+ok $page->is_ok, "Page 1 OK";
+ok !$page->is_error, "Page 1 error code " . $page->error_code;
my $form = $page->forms->[0];
-ok 3, $form->method eq "GET";
+
+is $form->method, 'GET', "Page 1 form method";
+
my @submit = $form->submits_named("Send");
-ok 4, @submit == 1;
+
+is @submit, 1, "Number of Send submits in page 1";
my $months = $form->widget_by_name("months");
$months->select("Jan");
my $send = $form->submit_by_name("Send");
my $page2 = $send->press;
-ok 5, !$page2->is_error;
-ok 6, !$page2->is_error;
-ok 7, $page2->form_count == 1;
-my $form2 = $page2->forms->[0];
+ok !$page2->is_error, "Page 2 error code " . $page2->error_code;
+is $page2->form_count, 1, "Page 2 form count";
+my $form2 = $page2->forms->[0];
@submit = $form2->submits_named("Send");
-ok 8, @submit == 1;
-ok 9, $form2->method eq "GET";
-ok 10, $form2->enctype !~ /^multipart/;
+
+is @submit, 1, "Number of Send submits in page 2";
+is $form2->method, 'GET', "Form 2 method";
+like $form2->enctype, qr/urlencoded/, "Form 2 encoding";
my $months2 = $form2->widget_by_name("months");
-ok 11, $months2->is_selected("Jul");
-ok 12, $months2->is_selected("Jan");
-ok 13, !$months2->is_selected("Feb");
+
+ok $months2->is_selected("Jul"), "Form 2 Jul is selected";
+ok $months2->is_selected("Jan"), "Form 2 Jan is selected";
+ok !$months2->is_selected("Feb"), "Form 2 Feb is not selected";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-test-perl.git
More information about the Pkg-perl-cvs-commits
mailing list