Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2004-05-31 Atsushi Enomoto <atsushi@ximian.com>
* anglia-test-runner.cs : Added support for RELAX NG compact syntax parser tests. * Makefile : added anglia-test support. * README : ditto. svn path=/trunk/mcs/; revision=28545
- Loading branch information
1 parent
776110a
commit da5275f
Showing
4 changed files
with
105 additions
and
10 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
mcs/class/Commons.Xml.Relaxng/Test/standalone_tests/ChangeLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 20 additions & 2 deletions
22
mcs/class/Commons.Xml.Relaxng/Test/standalone_tests/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,44 @@ | ||
RUNTIME = mono | ||
MCS_RUNTIME = | ||
MCS = mcs | ||
|
||
TESTS = relax-ng/001/i.rng | ||
TEST_ARCHIVE = testSuite.zip | ||
|
||
RNCTESTS = test/RNCTest.xml | ||
RNCTEST_ARCHIVE = anglia-test-suite.zip | ||
|
||
all : relaxngtest.exe anglia-test-runner.exe | ||
|
||
relaxngtest.exe : relaxngtest.cs $(TESTS) | ||
$(MCS_RUNTIME) $(MCS) relaxngtest.cs -r:Commons.Xml.Relaxng.dll | ||
$(MCS_RUNTIME) $(MCS) -debug+ relaxngtest.cs -r:Commons.Xml.Relaxng.dll | ||
|
||
anglia-test-runner.exe : anglia-test-runner.cs $(RNCTESTS) | ||
$(MCS_RUNTIME) $(MCS) -debug+ anglia-test-runner.cs -r:Commons.Xml.Relaxng.dll | ||
|
||
$(TESTS) : $(TEST_ARCHIVE) relax-ng | ||
cd relax-ng; unzip -n ../$(TEST_ARCHIVE); \ | ||
xsltproc split.xsl spectest.xml; cd ..; \ | ||
cp prep.xsl relax-ng | ||
|
||
$(RNCTESTS) : $(RNCTEST_ARCHIVE) | ||
unzip -n anglia-test-suite.zip | ||
|
||
$(TEST_ARCHIVE) : | ||
wget http://www.thaiopensource.com/relaxng/testSuite.zip | ||
|
||
$(RNCTEST_ARCHIVE) : | ||
wget http://www.jeffrafter.com/anglia/anglia-test-suite.zip | ||
|
||
relax-ng: | ||
mkdir relax-ng | ||
|
||
test : | ||
test : relaxngtest.exe | ||
$(RUNTIME) relaxngtest.exe | ||
|
||
anglia-test : anglia-test-runner.exe | ||
$(RUNTIME) anglia-test-runner.exe | ||
|
||
# be careful to use it. This removes ALL files in xml-test-suite! | ||
# clean: | ||
# rm -rf xml-test-suite |
40 changes: 32 additions & 8 deletions
40
mcs/class/Commons.Xml.Relaxng/Test/standalone_tests/README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
* standalone RELAX NG test program for the Test Suite | ||
|
||
** Introduction | ||
* Standalone test collection for Commons.Xml.Relaxng.dll | ||
|
||
** standalone RELAX NG test program for the Test Suite | ||
|
||
It is a test runner for James Clark's test collection. | ||
|
||
prep.xsl is included in Jing (a Java implementation of RELAX NG validator). | ||
copying.html is license information for prep.xsl and relaxng.rng. | ||
prep.xsl is originally included in Jing (a Java implementation of RELAX NG | ||
validator). copying.html is license information for prep.xsl and relaxng.rng. | ||
|
||
|
||
** standalone RELAX NG Compact Syntax test program for the "anglia" test suite | ||
|
||
** Usage | ||
It is a test runner for Jeff Rafter's "anglia" RNC test collection. | ||
|
||
To set up test runner, you need xsltproc, which is included in libxslt. | ||
|
||
** How to build | ||
|
||
NOTE: To set up test runner, you need xsltproc, which is included in libxslt. | ||
(Since the stylesheet uses extensions, we cannot use our xslt engine.) | ||
|
||
"make" will download the test collection from http://www.thaiopensource.com/relaxng/testSuite.zip , run xsltproc and create test directories and files. | ||
"make" will do the same as "make relaxngtest.exe" and | ||
"make anglia-test-runner.exe". | ||
|
||
"make relaxngtest.exe" will download the test collection from | ||
http://www.thaiopensource.com/relaxng/testSuite.zip and then run | ||
xsltproc to split tests and create test directories and files, and finally | ||
will compile relaxngtest.cs. | ||
|
||
"make anglia-test-runner.exe" will download the test collection from | ||
http://www.jeffrafter.com/anglia/anglia-test-suite.zip , and then will expand | ||
that archive, and finally will compile anglia-test-runner.cs. | ||
|
||
|
||
*** How to run | ||
|
||
"make test" will run relaxngtest.exe and will output the error cases. | ||
|
||
"make anglia-test" will run anglia-test-runner.exe and will output the | ||
error cases. | ||
|
||
"make test" will run the test program and will output the error cases. |
46 changes: 46 additions & 0 deletions
46
mcs/class/Commons.Xml.Relaxng/Test/standalone_tests/anglia-test-runner.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.IO; | ||
using System.Xml; | ||
using Commons.Xml.Relaxng; | ||
using Commons.Xml.Relaxng.Rnc; | ||
|
||
public class Driver | ||
{ | ||
public static void Main () | ||
{ | ||
try { | ||
XmlDocument doc = new XmlDocument (); | ||
doc.Load ("test/RNCTest.xml"); | ||
int success = 0; | ||
int failure = 0; | ||
foreach (XmlElement el in doc.SelectNodes ("/RNCTestCases/TestCase")) { | ||
string id = el.GetAttribute ("id"); | ||
bool isValid = el.GetAttribute ("legal") == "true"; | ||
RncParser p = new RncParser (new NameTable ()); | ||
try { | ||
string s = new StreamReader ("test" + Path.DirectorySeparatorChar + el.GetAttribute ("path")).ReadToEnd (); | ||
p.Parse (new StringReader (s)); | ||
if (isValid) { | ||
success++; | ||
// Console.Error.WriteLine ("valid " + id); | ||
} else { | ||
failure++; | ||
Console.Error.WriteLine ("INCORRECTLY VALID " + id); | ||
} | ||
} catch (Exception ex) { | ||
if (isValid) { | ||
failure++; | ||
Console.Error.WriteLine ("INCORRECTLY INVALID " + id + " --> " + ex.Message); | ||
} else { | ||
success++; | ||
// Console.Error.WriteLine ("invalid " + id); | ||
} | ||
} | ||
} | ||
Console.Error.WriteLine ("Total success: " + success); | ||
Console.Error.WriteLine ("Total failure: " + failure); | ||
} catch (Exception ex) { | ||
Console.Error.WriteLine ("Unexpected Exception: " + ex); | ||
} | ||
} | ||
} |