Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
using System;
using System.IO;
using System.Linq;
using System.Xml;
using System.Collections.Generic;
using NUnit.Framework;
using Monodoc;
using Monodoc.Generators;
using Monodoc.Generators.Html;
namespace MonoTests.Monodoc.Generators
{
[TestFixture]
public class AvoidCDataTextReaderTest
{
void AssertSameInputOutput (string expected, string input)
{
var processed = new AvoidCDataTextReader (new StringReader (input)).ReadToEnd ();
Assert.AreEqual (expected, processed);
}
[Test]
public void NoCDataXmlTest ()
{
var input = @"<elements><summary>Addressbook APIs.</summary><remarks /><class name=""ABAddressBook"" fullname=""MonoTouch.AddressBook.ABAddressBook"" assembly=""monotouch""><summary>
Provides access to the system Address Book.
</summary></class></elements>";
AssertSameInputOutput (input, input);
}
[Test]
public void WithCDataXmlTest ()
{
var input = @"<elements><summary>Addressbook APIs.</summary><remarks /><class name=""ABAddressBook"" fullname=""MonoTouch.AddressBook.ABAddressBook"" assembly=""monotouch""><summary><![CDATA[
Provides access to the system Address Book.]]>
</summary></class></elements>";
AssertSameInputOutput (input.Replace ("<![CDATA[", string.Empty).Replace ("]]>", string.Empty), input);
}
[Test]
public void PartialCDataXmlTest ()
{
var input = @"<elements><summary>Addressbook APIs.</summary><remarks /><class name=""ABAddressBook"" fullname=""MonoTouch.AddressBook.ABAddressBook"" assembly=""monotouch""><summary><![CDA[
Provides access to the system Address Book.]]>
</summary></class></elements>";
AssertSameInputOutput (input, input);
}
[Test]
public void FinishWithPartialCDataXmlTest ()
{
var input = @"<elements><summary>Addressbook APIs.</summary><remarks /><class name=""ABAddressBook"" fullname=""MonoTouch.AddressBook.ABAddressBook"" assembly=""monotouch""><summary>
Provides access to the system Address Book.
</summary></class></elements><![CDA[";
AssertSameInputOutput (input, input);
}
[Test]
public void FinishWithCDataXmlTest ()
{
var input = @"<elements><summary>Addressbook APIs.</summary><remarks /><class name=""ABAddressBook"" fullname=""MonoTouch.AddressBook.ABAddressBook"" assembly=""monotouch""><summary>
Provides access to the system Address Book.
</summary></class></elements><![CDATA[";
AssertSameInputOutput (input.Replace ("<![CDATA[", string.Empty), input);
}
[Test]
public void EmptyInputTest ()
{
AssertSameInputOutput (string.Empty, string.Empty);
}
[Test]
public void LimitedInputTest ()
{
AssertSameInputOutput ("foo", "foo");
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.IO;
using System.Linq;
using System.Xml;
using System.Collections.Generic;
using NUnit.Framework;
using Monodoc;
using Monodoc.Generators;
namespace MonoTests.Monodoc.Generators
{
[TestFixture]
public class RawGeneratorTests
{
const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
RootTree rootTree;
RawGenerator generator = new RawGenerator ();
[SetUp]
public void Setup ()
{
rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
}
void AssertValidXml (string xml)
{
var reader = XmlReader.Create (new StringReader (xml));
try {
while (reader.Read ());
} catch (Exception e) {
Console.WriteLine (e.ToString ());
Assert.Fail (e.Message);
}
}
void AssertEcmaFullTypeName (string xml, string fullTypeName)
{
var reader = XmlReader.Create (new StringReader (xml));
Assert.IsTrue (reader.ReadToFollowing ("Type"));
Assert.AreEqual (fullTypeName, reader.GetAttribute ("FullName"));
}
[Test]
public void TestSimpleEcmaXml ()
{
var xml = rootTree.RenderUrl ("T:System.String", generator);
Assert.IsNotNull (xml);
Assert.IsNotEmpty (xml);
AssertValidXml (xml);
AssertEcmaFullTypeName (xml, "System.String");
}
[Test]
public void TestSimpleEcmaXml2 ()
{
var xml = rootTree.RenderUrl ("T:System.Int32", generator);
Assert.IsNotNull (xml);
Assert.IsNotEmpty (xml);
AssertValidXml (xml);
AssertEcmaFullTypeName (xml, "System.Int32");
}
}
}