This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Re: new -file option to SimpleTestHarness
- From: Brian Jones <cbj at gnu dot org>
- To: raif at fl dot net dot au
- Cc: Mauve <mauve-discuss at sources dot redhat dot com>
- Date: 19 Dec 2002 11:04:25 -0500
- Subject: Re: new -file option to SimpleTestHarness
- References: <200212192234.09276.raif@fl.net.au>
"Raif S. Naffah" <raif@fl.net.au> writes:
> hello there,
>
> i'd like to propose the following patch to SimpleTestHarness to
> allow invoking the harness with the test classes file as one of its
> arguments. i.e. in addition to:
Ok.
>
> echo test_classes | \
> $(JAVA) -cp ... gnu.testlet.SimpleTestHarness -verbose -debug
>
> one can also do
>
> $(JAVA) -cp ... gnu.testlet.SimpleTestHarness -file test_classes
>
>
>
> $ diff -u -wb -B \
> ../mauve/mauve/gnu/testlet/SimpleTestHarness.java \
> source/gnu/testlet/SimpleTestHarness.java
> --- ../mauve/mauve/gnu/testlet/SimpleTestHarness.java 2002-11-15 20:05:47.000000000 +1100
> +++ source/gnu/testlet/SimpleTestHarness.java 2002-12-17 20:20:08.000000000 +1100
> @@ -286,6 +286,7 @@
> boolean verbose = false;
> boolean debug = false;
> boolean results_only = false;
> + String file = null;
> int i;
>
> for (i = 0; i < args.length; i++)
> @@ -300,6 +301,17 @@
> verbose = false;
> debug = false;
> }
> + else if (args[i].equalsIgnoreCase("-file"))
> + try
> + {
> + file = args[++i];
> + }
> + catch (Exception x)
> + {
> + if (verbose)
> + System.err.println ("Exception while processing '-file' option: "
> + +String.valueOf(x)+". Ignored");
> + }
> else
> break;
> }
> @@ -307,8 +319,22 @@
> SimpleTestHarness harness
> = new SimpleTestHarness (verbose, debug, results_only);
You need to get rid of this BufferedReader r = new ... before your additions.
If the file argument is given and the file does not exist, report the
error and exit maybe... ? Failing over to stdin doesn't seem logical.
>
> BufferedReader r
> = new BufferedReader (new InputStreamReader (System.in));
> + BufferedReader r = null;
> + boolean ok = false;
> + if (file != null)
> + try
> + {
> + r = new BufferedReader (new FileReader (file));
> + ok = true;
> + }
> + catch (FileNotFoundException x)
> + {
> + if (verbose)
> + System.err.println ("File not found: "+String.valueOf(file)
> + +". Revert to stdin");
> + }
> + if (!ok)
> + r = new BufferedReader (new InputStreamReader (System.in));
> while (true)
> {
> String cname = null;
>
>
--
Brian Jones <cbj@gnu.org>