Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkatsiaryna_bialiatka <katsiaryna_bialiatka@epam.com>2017-12-22 19:15:31 +0300
committerJoel Martinez <joelmartinez@gmail.com>2018-01-12 01:11:42 +0300
commit6533035ec31f38543532568bc499aba2a98e1788 (patch)
treec9e7e3bdefd3299bfbf28dd5bd6b5bcc43fd988f /mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
parent8ff2931c4e40e1c3687e8efa6fb4e8078b3a3c4b (diff)
[mdoc] Support for C++ signatures
Closes #132
Diffstat (limited to 'mdoc/mdoc.Test/CppCxFormatterTypesTests.cs')
-rw-r--r--mdoc/mdoc.Test/CppCxFormatterTypesTests.cs197
1 files changed, 197 insertions, 0 deletions
diff --git a/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
new file mode 100644
index 00000000..be2bd186
--- /dev/null
+++ b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
@@ -0,0 +1,197 @@
+using System;
+using Mono.Cecil;
+using Mono.Documentation.Updater.Formatters.CppFormatters;
+using Mono_DocTest;
+using Mono_DocTest_Generic;
+using NUnit.Framework;
+
+namespace mdoc.Test
+{
+ [TestFixture]
+ [Category("CppCx")]
+ public class CppCxFormatterTypesTests : BasicFormatterTests<CppCxMemberFormatter>
+ {
+ protected override CppCxMemberFormatter formatter => new CppCxMemberFormatter();
+
+ private string _cppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd";
+
+ protected override TypeDefinition GetType(Type type)
+ {
+ var moduleName = type.Module.FullyQualifiedName;
+
+ var tref = GetType(moduleName, type.FullName?.Replace("+", "/"));
+ return tref;
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_CustomAttribute()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.CustomAttribute1",
+ "public ref class CustomAttribute1 sealed : Platform::Metadata::Attribute");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_Class1()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.Class1",
+ "public ref class Class1 sealed");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_delegate()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.PrimeFoundHandler",
+ "public delegate void PrimeFoundHandler(int result);");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_delegateWithSpecificType()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.PrimeFoundHandlerWithSpecificType",
+ "public delegate void PrimeFoundHandlerWithSpecificType(IMap<double, float> ^ result);");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_delegateWithCustomType()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.SomethingHappenedEventHandler",
+ "public delegate void SomethingHappenedEventHandler(Class1 ^ sender, Platform::String ^ s);");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_enum()
+ {
+ TestTypeSignature(_cppCxTestLibName, "UwpTestWinRtComponentCpp.Color1", "public enum class Color1");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_publicUnsealedClass()
+ {
+ TestTypeSignature(_cppCxTestLibName, "Namespace2.Class2", @"public ref class Class2 : Windows::UI::Xaml::Application");
+
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_ValueClass()
+ {
+ TestTypeSignature(_cppCxTestLibName, "Namespace2.Class4", "public value class Class4");
+ }
+
+ #region NoSupport
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_GenericDelegate()
+ {
+ TestTypeSignature(typeof(Action22<>), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_DelegateWithSystemType()
+ {
+ TestTypeSignature(typeof(DelegateWithNetSystemType), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_NoNamespace()
+ {
+ TestTypeSignature(typeof(NoNamespace), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_StandardType()
+ {
+ TestMethodSignature(typeof(UseLists), null, nameof(UseLists.Process));
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_PublicNestedType()
+ {
+ TestTypeSignature(typeof(Widget.NestedClass), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_PublicNestedEnum()
+ {
+ TestTypeSignature(typeof(Widget.NestedEnum), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_JaggedArrays()
+ {
+ TestMethodSignature(typeof(Widget), null, "M2");
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_PublicConstructorUnsealedClass()
+ {
+ TestTypeSignature(typeof(DocAttribute), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_PublicRefClassWithGeneric()
+ {
+ TestTypeSignature(typeof(GenericBase<>), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_GenericInterfaceWithConstraints()
+ {
+ TestTypeSignature(typeof(IFooNew<>), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_ValueTypeWithNotAllowedType()
+ {
+ TestTypeSignature(typeof(ValueClassSpecificField), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_PublicIndexedProperty()
+ {
+ TestPropertySignature(typeof(Widget), null, "indexedProperty");
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_CustomException()
+ {
+ TestTypeSignature(typeof(CustomException), null);
+ }
+
+ [Test]
+ [Category("NoSupport")]
+ public void NoSupport_Exception_ArgumentNullExceptionField()
+ {
+ TestFieldSignature(typeof(CustomException), null, "ArgumentNullExceptionField");
+ }
+
+ #endregion
+
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ moduleCash.Clear();
+ }
+ }
+}
+