[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/t 05paragraph.t test_utils.pl 16raw.t
From: |
Patrice Dumas |
Subject: |
texinfo/tp/t 05paragraph.t test_utils.pl 16raw.t |
Date: |
Thu, 23 Sep 2010 20:00:01 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/09/23 20:00:00
Modified files:
tp/t : 05paragraph.t test_utils.pl
Added files:
tp/t : 16raw.t
Log message:
Enhancements to the test infrastructure.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/05paragraph.t?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/16raw.t?cvsroot=texinfo&rev=1.1
Patches:
Index: 05paragraph.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/05paragraph.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 05paragraph.t 23 Sep 2010 17:26:41 -0000 1.2
+++ 05paragraph.t 23 Sep 2010 20:00:00 -0000 1.3
@@ -5,11 +5,6 @@
require 't/test_utils.pl';
-my $generate;
-# $generate = 1;
-my $debug;
-# $debug = 1;
-
my @test_cases = (
[ 'text', 'text' ],
[ 'text comment', 'address@hidden comment' ],
@@ -34,21 +29,9 @@
']
);
-# following may be cut and paste.
+our ($arg_test_case, $arg_generate, $arg_debug);
-if ($generate) {
- plan tests => 1;
-}
-else {
- plan tests => (1 + scalar(@test_cases) * 3);
-}
+run_test_case ('paragraph', address@hidden, $arg_test_case,
+ $arg_generate, $arg_debug);
ok(1);
-
-my $test = new_test('paragraph', $generate, $debug);
-
-foreach my $test_case (@test_cases) {
- $test->test($test_case);
-}
-
-$test->end_test();
Index: test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- test_utils.pl 23 Sep 2010 17:26:41 -0000 1.5
+++ test_utils.pl 23 Sep 2010 20:00:00 -0000 1.6
@@ -3,9 +3,18 @@
use Texinfo::Parser qw(:all);
use Data::Dumper;
use Data::Compare;
+use Getopt::Long qw(GetOptions);
use vars qw(%result_texts %result_trees %result_errors);
+our $arg_generate;
+our $arg_debug;
+
+Getopt::Long::Configure("gnu_getopt");
+GetOptions('g|generate' => \$arg_generate, 'd|debug' => \$arg_debug);
+
+our $arg_test_case = shift @ARGV;
+
sub new_test ($;$$)
{
my $name = shift;
@@ -71,4 +80,37 @@
}
}
+sub run_test_case($$;$$$)
+{
+ my $name = shift;
+ my $test_cases = shift;
+ my $test_case_name = shift;
+ my $generate = shift;
+ my $debug = shift;
+
+ my $test = new_test($name, $generate, $debug);
+ my $ran_tests = $test_cases;
+ if (defined($test_case_name)) {
+ if ($test_case_name =~ /^\d+$/) {
+ $ran_tests = [ $test_cases->[$test_case_name-1] ];
+ } else {
+ foreach my $test_case (@$test_cases) {
+ $ran_tests = [ $test_case ] if ($test_case->[0] eq $test_case_name);
+ }
+ }
+ }
+
+ if ($generate) {
+ plan tests => 1;
+ } else {
+ plan tests => (1 + scalar(@$ran_tests) * 3);
+ }
+
+ foreach my $test_case (@$ran_tests) {
+ $test->test($test_case);
+ }
+
+ $test->end_test();
+}
+
1;
Index: 16raw.t
===================================================================
RCS file: 16raw.t
diff -N 16raw.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 16raw.t 23 Sep 2010 20:00:00 -0000 1.1
@@ -0,0 +1,48 @@
+use strict;
+
+use Test::More;
+
+require 't/test_utils.pl';
+
+my @test_cases = (
+[ 'nested macros', '@macro truc { arg, ex}
+in macro \arg\
address@hidden othermacro
+other macro
address@hidden macro
address@hidden
address@hidden macro
+'],
+['misc raw','
address@hidden
+in html @end html
+
address@hidden in tex
address@hidden tex
+
address@hidden
+in verbatim
+in verbatim2
address@hidden verbatim
+'],
+['misc raw comments','
address@hidden @c comment space
+in html @end address@hidden comment no space
+
address@hidden in tex
address@hidden tex @c comment after end tex
+
address@hidden
+in verbatim @c in verbatim
+in verbatim2
address@hidden verbatim
+'],
+);
+
+our ($arg_test_case, $arg_generate, $arg_debug);
+
+run_test_case ('raw', address@hidden, $arg_test_case,
+ $arg_generate, $arg_debug);
+
+ok(1);
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/t 05paragraph.t test_utils.pl 16raw.t,
Patrice Dumas <=