Update of /cvsroot/http-webtest/HTTP-WebTest/t
In directory usw-pr-cvs1:/tmp/cvs-serv5291/t
Modified Files:
02-generic.t
Log Message:
Allow to modify test queue in runtime
Index: 02-generic.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** 02-generic.t 22 Aug 2002 07:39:38 -0000 1.14
--- 02-generic.t 24 Sep 2002 20:22:12 -0000 1.15
***************
*** 18,22 ****
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 32 }
# init tests
--- 18,22 ----
use vars qw($HOSTNAME $PORT $URL);
! BEGIN { plan tests => 33 }
# init tests
***************
*** 595,598 ****
--- 595,628 ----
check_file => "t/test.out/handle-redirects-$bool");
}
+ }
+
+ # 33: test adding new tests in runtime
+ {
+ my $sub = sub {
+ my $webtest = shift;
+ # use this sub to tweak test queue in runtime
+
+ # append a new test at the end of the queue
+ push @{$webtest->tests},
+ $webtest->convert_tests({ url => abs_url($URL, '/test-file2'),
+ text_require => [ qw(begin 644) ],
+ });
+
+ # insert a new test after the current test
+ splice @{$webtest->tests}, $webtest->last_test_num + 1,
+ 0, $webtest->convert_tests({ url => abs_url($URL, '/status-forbidden') });
+
+ return abs_url($URL, '/test-file1');
+ };
+
+ my $tests = [ { url => $sub,
+ text_require => [ qw(abcde) ],
+ }
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ check_file => 't/test.out/runtime-insert');
}
|