diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 22:36:25 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 23:47:18 +0300 |
commit | 1f3ab29158039d49c0e392ec580661ab8537e052 (patch) | |
tree | ee499be9fccb9564cc456a1ebc67c15749d366af /mcs/class | |
parent | 85c8db4edb8081e54c1a2ac3a5da6c5e131173d3 (diff) |
[Commons.Xml.Relaxng] Switch tests to use embedded test resources
Diffstat (limited to 'mcs/class')
7 files changed, 38 insertions, 23 deletions
diff --git a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng_test.dll.sources b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng_test.dll.sources index a50fa519e43..fcf2278feb3 100644 --- a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng_test.dll.sources +++ b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng_test.dll.sources @@ -1,3 +1,4 @@ +../../test-helpers/TestResourceHelper.cs RdpPatternTests.cs RelaxngDatatypeProviderTests.cs RelaxngReaderTests.cs diff --git a/mcs/class/Commons.Xml.Relaxng/Makefile b/mcs/class/Commons.Xml.Relaxng/Makefile index f9b57fea265..c508f063be7 100644 --- a/mcs/class/Commons.Xml.Relaxng/Makefile +++ b/mcs/class/Commons.Xml.Relaxng/Makefile @@ -11,15 +11,20 @@ LIB_REFS = System System.Xml KEYFILE = ../mono.pub LIB_MCS_FLAGS = \ $(foreach r, $(OTHER_RES), /resource:$(r),$(notdir $(r))) -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 -EXTRA_DISTFILES = \ - Commons.Xml.Relaxng.Rnc/RncParser.jay \ + +TEST_RESOURCE_FILES = \ $(wildcard Test/XmlFiles/*.rng) \ $(wildcard Test/XmlFiles/*.rnc) \ $(wildcard Test/XmlFiles/*.nvdl) \ - $(wildcard Test/XmlFiles/*.xml) \ + $(wildcard Test/XmlFiles/*.xml) + +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 $(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r)) + +EXTRA_DISTFILES = \ + Commons.Xml.Relaxng.Rnc/RncParser.jay \ $(wildcard Test/standalone_tests/*.cs) \ - $(RESOURCE_FILES) + $(RESOURCE_FILES) \ + $(TEST_RESOURCE_FILES) Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs $(topdir)/jay/jay -ctv -o Commons.Xml.Relaxng.Rnc/RncParser.cs $< < $(topdir)/jay/skeleton.cs diff --git a/mcs/class/Commons.Xml.Relaxng/Test/NvdlValidatingReaderTests.cs b/mcs/class/Commons.Xml.Relaxng/Test/NvdlValidatingReaderTests.cs index 8f0ae73cf6d..bb0f740dc48 100644 --- a/mcs/class/Commons.Xml.Relaxng/Test/NvdlValidatingReaderTests.cs +++ b/mcs/class/Commons.Xml.Relaxng/Test/NvdlValidatingReaderTests.cs @@ -13,6 +13,8 @@ using System.Xml; using Commons.Xml.Nvdl; using NUnit.Framework; +using MonoTests.Helpers; + namespace MonoTests.Commons.Xml.Relaxng { [TestFixture] @@ -21,7 +23,7 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void ReadNvdlNvdl () { - using (TextReader r = File.OpenText ("Test/XmlFiles/nvdl.nvdl")) { + using (TextReader r = File.OpenText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl"))) { NvdlRules rules = NvdlReader.Read ( new XmlTextReader (r)); } @@ -31,7 +33,7 @@ namespace MonoTests.Commons.Xml.Relaxng public void ValidateNvdlNvdl () { NvdlRules rules = null; - string path = "Test/XmlFiles/nvdl.nvdl"; + string path = TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl"); using (TextReader r = File.OpenText (path)) { rules = NvdlReader.Read ( new XmlTextReader (path, r)); diff --git a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngDatatypeProviderTests.cs b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngDatatypeProviderTests.cs index ccf4e5d1918..70e2c2f6b46 100644 --- a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngDatatypeProviderTests.cs +++ b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngDatatypeProviderTests.cs @@ -12,6 +12,8 @@ using Commons.Xml.Relaxng; using Commons.Xml.Relaxng.XmlSchema; using NUnit.Framework; +using MonoTests.Helpers; + namespace MonoTests.Commons.Xml.Relaxng { [TestFixture] @@ -23,7 +25,7 @@ namespace MonoTests.Commons.Xml.Relaxng var datatypeLibrary = SetupMyDataProvider (); XmlDocument xml = new XmlDocument (); xml.LoadXml ("<root> <v1>mytype</v1> <v2>1</v2> </root>"); - XmlDocument schemaXml = ReadDoc ("Test/XmlFiles/463264.rng"); + XmlDocument schemaXml = ReadDoc (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/463264.rng")); XmlReader reader = new RelaxngValidatingReader (new XmlNodeReader (xml), new XmlNodeReader (schemaXml), datatypeLibrary); while (reader.Read ()) ; @@ -35,7 +37,7 @@ namespace MonoTests.Commons.Xml.Relaxng var datatypeLibrary = SetupMyDataProvider (); XmlDocument xml = new XmlDocument (); xml.LoadXml ("<root> <v2>1</v2> <v1>mytype</v1> </root>"); - XmlDocument schemaXml = ReadDoc ("Test/XmlFiles/463267.rng"); + XmlDocument schemaXml = ReadDoc (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/463267.rng")); XmlReader reader = new RelaxngValidatingReader (new XmlNodeReader (xml), new XmlNodeReader (schemaXml), datatypeLibrary); while (reader.Read ()) ; diff --git a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngReaderTests.cs b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngReaderTests.cs index 802da2d1755..ca1df825b02 100644 --- a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngReaderTests.cs +++ b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngReaderTests.cs @@ -13,6 +13,8 @@ using System.Xml; using Commons.Xml.Relaxng; using NUnit.Framework; +using MonoTests.Helpers; + namespace MonoTests.Commons.Xml.Relaxng { [TestFixture] @@ -33,7 +35,7 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void SimpleRead () { - loadGrammarFromUrl ("Test/XmlFiles/SimpleElementPattern1.rng"); + loadGrammarFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.rng")); RelaxngPattern p = reader.ReadPattern (); Assert.AreEqual (RelaxngPatternType.Element, p.PatternType); @@ -42,7 +44,7 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void CompileRelaxngGrammar () { - loadGrammarFromUrl ("Test/XmlFiles/relaxng.rng"); + loadGrammarFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")); RelaxngPattern p = reader.ReadPattern (); Assert.AreEqual (RelaxngPatternType.Grammar, p.PatternType); diff --git a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngValidatingReaderTests.cs b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngValidatingReaderTests.cs index 62e4924d884..bdf92baf981 100644 --- a/mcs/class/Commons.Xml.Relaxng/Test/RelaxngValidatingReaderTests.cs +++ b/mcs/class/Commons.Xml.Relaxng/Test/RelaxngValidatingReaderTests.cs @@ -14,6 +14,7 @@ using Commons.Xml.Relaxng; using NUnit.Framework; using RVR = Commons.Xml.Relaxng.RelaxngValidatingReader; +using MonoTests.Helpers; namespace MonoTests.Commons.Xml.Relaxng { @@ -45,8 +46,8 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void SimpleElementPattern1 () { - SetupReaderFromUrl ("Test/XmlFiles/SimpleElementPattern1.xml", - "Test/XmlFiles/SimpleElementPattern1.rng"); + SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.xml"), + TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.rng")); while (!reader.EOF) reader.Read (); @@ -55,8 +56,8 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void SimpleElementPattern2 () { - SetupReaderFromUrl ("Test/XmlFiles/SimpleElementPattern2.xml", - "Test/XmlFiles/SimpleElementPattern2.rng"); + SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.xml"), + TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.rng")); while (!reader.EOF) reader.Read (); @@ -65,7 +66,7 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void ReadPracticalSample1 () { - SetupReaderFromUrl ("Test/XmlFiles/team.xml", "Test/XmlFiles/team.rng"); + SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/team.xml"), TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/team.rng")); while (!reader.EOF) reader.Read (); } @@ -75,8 +76,8 @@ namespace MonoTests.Commons.Xml.Relaxng { // validate relaxng.rng with relaxng.rng RVR r = new RVR ( - new XmlTextReader ("Test/XmlFiles/relaxng.rng"), - new XmlTextReader ("Test/XmlFiles/relaxng.rng")); + new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")), + new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng"))); while (!r.EOF) r.Read (); } diff --git a/mcs/class/Commons.Xml.Relaxng/Test/RncTests.cs b/mcs/class/Commons.Xml.Relaxng/Test/RncTests.cs index fb7ac65e9c7..9703b4cb65e 100644 --- a/mcs/class/Commons.Xml.Relaxng/Test/RncTests.cs +++ b/mcs/class/Commons.Xml.Relaxng/Test/RncTests.cs @@ -15,6 +15,8 @@ using Commons.Xml.Relaxng; using Commons.Xml.Relaxng.Rnc; using NUnit.Framework; +using MonoTests.Helpers; + namespace MonoTests.Commons.Xml.Relaxng { [TestFixture] @@ -43,19 +45,19 @@ namespace MonoTests.Commons.Xml.Relaxng [Test] public void TestRelaxngRnc () { - Compile ("Test/XmlFiles/relaxng.rnc"); + Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rnc")); } [Test] public void TestAtomRnc () { - Compile ("Test/XmlFiles/atom.rnc"); + Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/atom.rnc")); } [Test] public void TestInfocardRnc () { - Compile ("Test/XmlFiles/schemas-xmlsoap-or-ws-2005-05-identity.rnc"); + Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/schemas-xmlsoap-or-ws-2005-05-identity.rnc")); } [Test] @@ -85,8 +87,8 @@ start = mine"; [Test] public void InheritDefaultNamespace () { - RelaxngPattern g = Compile ("Test/XmlFiles/include-default-namespace.rnc"); - XmlReader xtr = new XmlTextReader ("Test/XmlFiles/include-default-namespace.xml"); + RelaxngPattern g = Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/include-default-namespace.rnc")); + XmlReader xtr = new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/include-default-namespace.xml")); RelaxngValidatingReader r = new RelaxngValidatingReader (xtr, g); try { while (!r.EOF) |