[tests] Port the makefile-based generator tests to NUnit. (#3019)

* [tests][generator] Port bindas1048error to NUnit.

* [tests][generator] Port bindas1049error to NUnit.

* [tests][generator] Port bindas1050modelerror to NUnit.

* [tests][generator] Port bindas1050protocolerror to NUnit.

* [tests][generator] Port bug42855 to NUnit.

* [tests][generator] Port bug57070 to NUnit.

* [tests][generator] Port bug52570classinternal to NUnit.

* [tests][generator] Port bug52570methodinternal to NUnit.

* [tests][generator] Port bug52570allowstaticmembers to NUnit.

* [tests][generator] Port protocol-duplicate-abstract-error to NUnit.

* [tests][generator] Port protocol-duplicate-method-diff-length to NUnit.

* [tests][generator] Port protocol-duplicate-method-diff-out to NUnit.

* [tests][generator] Port protocol-duplicate-method-diff-type to NUnit.

* [tests][generator] Port protocol-duplicate-method-diff-return to NUnit.

* [tests][generator] Port warnaserror to NUnit.

* [tests][generator] Port nowarn to NUnit.

* [tests][generator] Add support for inspecting/asserting the generated content.

* [tests][generator] Port some Xamarin.Mac tests to NUnit.

Ported:

* bmac_smoke
* bmac-with-hyphen-in-name
* property-redefination-mac
* NSApplicationPublicEnsureMethods
* protocol-duplicate-abstract

* [tests][generator] Point bgen to our local installation.

* [tests][generator] Port the bug31788 test to a unit test.

* [generator] Make the 'bgen' helper target more complete.

* [tests][generator] Port non-custom iOS tests to unit tests.

* [tests][generator] Add new test.

* [tests][generator] Port the forum54078 test to a unit test.

* [tests][generator] Port the desk63279 test to a unit test.

* [tests][generator] Port the desk79124 test to a unit test.

* [tests][generator] Port the multiple-api-definitions tests to unit tests.

* [generator] Use mono code style.

* [tests][generator] Port the bug29493 test to a unit test.

* [tests][generator] Port the classNameCollision test to a unit test.

* [tests][generator] Port the bi1036 test to a unit test.

* [tests][generator] Port the bug37527 test to a unit test.

Also fix BI1112 and BI1113 to show up as errors in the console output (since
they're exceptions they're already treated as errors and would cause bgen to
fail).

* [tests][generator] Port the bug27986 test to a unit test.

* [tests][generator] Port the bug35176 test to a unit test.

* [tests][generator] Port the bi1046 test to a unit test.

* [tests][generator] Port the virtualwrap test to a unit test.

* [tests][generator] Port the bug42742 test to a unit test.

* [tests][generator] Port the noasyncinternalwrapper test to a unit test.

* [tests][generator] Port the noasyncwarningcs0219 test to a unit test.

* [tests][generator] Port the bug53076 test to a unit test.

* [tests][generator] Port the bug53076withmodel test to a unit test.

* [tests][generator] Port the fieldenumtests test to a unit test.

* [tests][generator] Port the smartenumwithframework test to a unit test.

* [tests][generator] Port the forcedtype test to a unit test.

* [tests][generator] Port the bug46292 test to a unit test.

* [tests][generator] Build tests with MSBuild.

There's no need to use xbuild for these tests.

* [tests][generator] Remove dead code.

* [xharness] Don't run the makefile-based generator tests anymore.

Since there aren't any makefile-based generator tests anymore, they've all
been ported to NUnit tests.

* [tests][generator] Make the bug39614 test do what it was supposed to do: make sure a namespace isn't required (but recommended).
This commit is contained in:
Rolf Bjarne Kvinge 2017-11-20 14:55:16 +01:00 коммит произвёл GitHub
Родитель 467ec0cd83
Коммит efebe2b73b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
17 изменённых файлов: 1104 добавлений и 295 удалений

Просмотреть файл

@ -226,8 +226,15 @@ $(MAC_BUILD_DIR)/Xamarin.Mac-%.BindingAttributes.dll: generator-attributes.cs Ma
$(Q_GEN) $(SYSTEM_MONO) --debug $(PMCS_EXE) -profile:"$(TOP)/src/pmcs-profiles/$*" -compiler:$(SYSTEM_MCS) -global-replace:"^XamCore.=" -out:$@ -debug generator-attributes.cs -target:library
bgen: \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/bgen.exe \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/XamMac.BindingAttributes.dll \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-full.BindingAttributes.dll \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-mobile.BindingAttributes.dll \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/monotouch.BindingAttributes.dll \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.TVOS.BindingAttributes.dll \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.WatchOS.BindingAttributes.dll \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe \
$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen \

Просмотреть файл

@ -6941,14 +6941,14 @@ public partial class Generator : IMemberGatherer {
}
}
if (props.Count () == 1)
throw new BindingException (1112,
throw new BindingException (1112, true,
"Property {0} should be renamed to 'Delegate' for BaseType.Events and BaseType.Delegates to work.", props[0], false);
else if (props.Count () > 1)
throw new BindingException (1112,
throw new BindingException (1112, true,
"Properties {0} should be renamed to 'Delegate' for BaseType.Events and BaseType.Delegates to work.",
String.Join (", ", props.ToArray ()), false);
else
throw new BindingException (1113,
throw new BindingException (1113, true,
"BaseType.Delegates were set but no properties could be found. Do ensure that the WrapAttribute is used on the right properties.", false);
} else
throw new BindingException (1114, "Binding error: test unable to find property: {0} on {1}", propertyName, type, false);

Просмотреть файл

@ -20,4 +20,32 @@ Global
{10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.FileWidth = 180
$1.TabWidth = 8
$1.IndentWidth = 8
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.IndentSwitchSection = False
$2.NewLinesForBracesInProperties = False
$2.NewLinesForBracesInAccessors = False
$2.NewLinesForBracesInAnonymousMethods = False
$2.NewLinesForBracesInControlBlocks = False
$2.NewLinesForBracesInAnonymousTypes = False
$2.NewLinesForBracesInObjectCollectionArrayInitializers = False
$2.NewLinesForBracesInLambdaExpressionBody = False
$2.NewLineForElse = False
$2.NewLineForCatch = False
$2.NewLineForFinally = False
$2.NewLineForMembersInObjectInit = False
$2.NewLineForMembersInAnonymousTypes = False
$2.NewLineForClausesInQuery = False
$2.SpacingAfterMethodDeclarationName = True
$2.SpaceAfterMethodCallName = True
$2.SpaceBeforeOpenSquareBracket = True
$2.scope = text/x-csharp
$2.SpaceAfterCast = True
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,23 @@
using System;
using Mono.Cecil;
using Mono.Cecil.Cil;
using NUnit.Framework;
namespace GeneratorTests
{
public static class Asserts
{
public static void DoesNotThrowExceptions (MethodReference method, string message)
{
var instructions = method.Resolve ().Body.Instructions;
foreach (var ins in instructions) {
if (ins.OpCode.FlowControl != FlowControl.Throw)
continue;
Assert.Fail ($"The method '{method.FullName}' unexpectedly throws an exception at offset {ins.Offset}: {message}\n\t{string.Join ("\n\t", instructions)}");
}
}
}
}

Просмотреть файл

@ -0,0 +1,495 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Xamarin.Tests;
namespace GeneratorTests
{
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class BGenTests
{
[Test]
[TestCase (Profile.macClassic)]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
public void BMac_Smoke (Profile profile)
{
BuildFile (profile, "bmac_smoke.cs");
}
[Test]
[TestCase (Profile.macClassic)]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
public void BMac_With_Hyphen_In_Name (Profile profile)
{
BuildFile (profile, "bmac-with-hyphen-in-name.cs");
}
[Test]
[TestCase (Profile.macClassic)]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
public void PropertyRedefinitionMac (Profile profile)
{
BuildFile (profile, "property-redefination-mac.cs");
}
[Test]
[TestCase (Profile.macClassic)]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
public void NSApplicationPublicEnsureMethods (Profile profile)
{
BuildFile (profile, "NSApplicationPublicEnsureMethods.cs");
}
[Test]
[TestCase (Profile.macClassic)]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
public void ProtocolDuplicateAbstract (Profile profile)
{
BuildFile (profile, "protocol-duplicate-abstract.cs");
}
[Test]
public void Bug15283 ()
{
BuildFile (Profile.iOS, "bug15283.cs");
}
[Test]
public void Bug15307 ()
{
BuildFile (Profile.iOS, "bug15307.cs");
}
[Test]
public void Bug15799 ()
{
BuildFile (Profile.iOS, "bug15799.cs");
}
[Test]
public void Bug16036 ()
{
BuildFile (Profile.iOS, "bug16036.cs");
}
[Test]
public void Bug17232 ()
{
BuildFile (Profile.iOS, "bug17232.cs");
}
[Test]
public void Bug23041 ()
{
BuildFile (Profile.iOS, "bug23041.cs");
}
[Test]
public void Bug24078 ()
{
BuildFile (Profile.iOS, "bug24078-ignore-methods-events.cs");
}
[Test]
public void Bug27428 ()
{
BuildFile (Profile.iOS, "bug27428.cs");
}
[Test]
public void Bug27430 ()
{
BuildFile (Profile.iOS, "bug27430.cs");
}
[Test]
public void Bug27986 ()
{
var bgen = BuildFile (Profile.iOS, false, "bug27986.cs");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMembers = ((IEnumerable<ICustomAttributeProvider>) allTypes)
.Union (allTypes.SelectMany ((type) => type.Methods))
.Union (allTypes.SelectMany ((type) => type.Fields))
.Union (allTypes.SelectMany ((type) => type.Properties));
var preserves = allMembers.Count ((v) => v.HasCustomAttributes && v.CustomAttributes.Any ((ca) => ca.AttributeType.Name == "PreserveAttribute"));
Assert.AreEqual (28, preserves, "Preserve attribute count"); // If you modified code that generates PreserveAttributes please update the preserve count
}
[Test]
public void Bug29493 ()
{
var bgen = BuildFile (Profile.iOS, false, "bug29493.cs");
// Check that there is no call to Class.GetHandle with a "global::"-prefixed string
foreach (var method in bgen.ApiAssembly.MainModule.GetTypes ().SelectMany ((v) => v.Methods)) {
if (!method.HasBody)
continue;
var instructions = method.Body.Instructions;
foreach (var ins in instructions) {
if (ins.OpCode.FlowControl != FlowControl.Call)
continue;
var mr = (MethodReference) ins.Operand;
if (mr.DeclaringType.Namespace != "ObjCRuntime" && mr.DeclaringType.Name != "Class")
continue;
if (mr.Name != "GetHandle" && mr.Name != "GetHandleIntrinsic")
continue;
var str = (string) ins.Previous.Operand;
if (str.StartsWith ("global::", StringComparison.Ordinal))
Assert.Fail ($"Found a call to Class.GetHandle with an invalid ('global::'-prefixed) string in {method.FullName} at offset {ins.Offset}.\n\t{string.Join ("\n\t", instructions)}");
}
}
}
[Test]
public void Bug31788 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.macClassic;
bgen.Defines = BGenTool.GetDefaultDefines (bgen.Profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug31788.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
bgen.AssertApiCallsMethod ("Test", "MarshalInProperty", "get_Shared", "xamarin_IntPtr_objc_msgSend", "MarshalInProperty.Shared getter");
bgen.AssertApiCallsMethod ("Test", "MarshalOnProperty", "get_Shared", "xamarin_IntPtr_objc_msgSend", "MarshalOnProperty.Shared getter");
}
[Test]
public void Bug34042 ()
{
BuildFile (Profile.iOS, "bug34042.cs");
}
[Test]
public void Bug35176 ()
{
var bgen = BuildFile (Profile.iOS, "bug35176.cs");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMembers = ((IEnumerable<ICustomAttributeProvider>) allTypes)
.Union (allTypes.SelectMany ((type) => type.Methods))
.Union (allTypes.SelectMany ((type) => type.Fields))
.Union (allTypes.SelectMany ((type) => type.Properties));
var preserves = allMembers.Sum ((v) => v.CustomAttributes.Count ((ca) => ca.AttributeType.Name == "IntroducedAttribute"));
Assert.AreEqual (8, preserves, "Introduced attribute count"); // If you modified code that generates IntroducedAttributes please update the attribute count
}
[Test]
public void Bug36457 ()
{
BuildFile (Profile.iOS, "bug36457.cs");
}
[Test]
public void Bug39614 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("bug39614.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
bgen.AssertWarning (1103, "'FooType`1' does not live under a namespace; namespaces are a highly recommended .NET best practice");
}
[Test]
public void Bug40282 ()
{
BuildFile (Profile.iOS, "bug40282.cs");
}
[Test]
public void Bug42742 ()
{
var bgen = BuildFile (Profile.iOS, "bug42742.cs");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMembers = ((IEnumerable<ICustomAttributeProvider>) allTypes)
.Union (allTypes.SelectMany ((type) => type.Methods))
.Union (allTypes.SelectMany ((type) => type.Fields))
.Union (allTypes.SelectMany ((type) => type.Properties));
var preserves = allMembers.Sum ((v) => v.CustomAttributes.Count ((ca) => ca.AttributeType.Name == "AdviceAttribute"));
Assert.AreEqual (24, preserves, "Advice attribute count"); // If you modified code that generates AdviceAttributes please update the attribute count
}
[Test]
public void Bug43579 ()
{
BuildFile (Profile.iOS, "bug43579.cs");
}
[Test]
public void Bug46292 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.ProcessEnums = true;
bgen.AddTestApiDefinition ("bug46292.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMembers = ((IEnumerable<ICustomAttributeProvider>) allTypes)
.Union (allTypes.SelectMany ((type) => type.Methods))
.Union (allTypes.SelectMany ((type) => type.Fields))
.Union (allTypes.SelectMany ((type) => type.Properties));
var attribCount = allMembers.Count ((v) => v.HasCustomAttributes && v.CustomAttributes.Any ((ca) => ca.AttributeType.Name == "ObsoleteAttribute"));
Assert.AreEqual (2, attribCount, "attribute count");
}
[Test]
public void Bug53076 ()
{
var bgen = BuildFile (Profile.iOS, "bug53076.cs");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMethods = bgen.ApiAssembly.MainModule.GetTypes ().SelectMany ((type) => type.Methods);
// Count all *Async methods whose first parameter is 'IMyFooProtocol'.
var methodCount = allMethods.Count ((v) => v.Name.EndsWith ("Async", StringComparison.Ordinal) && v.Parameters.Count > 0 && v.Parameters [0].ParameterType.Name == "IMyFooProtocol");
Assert.AreEqual (10, methodCount, "Async method count");
}
[Test]
public void Bug53076WithModel ()
{
var bgen = BuildFile (Profile.iOS, "bug53076withmodel.cs");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMethods = bgen.ApiAssembly.MainModule.GetTypes ().SelectMany ((type) => type.Methods);
// Count all *Async methods whose first parameter is 'IMyFooProtocol'.
var methodCount = allMethods.Count ((v) => v.Name.EndsWith ("Async", StringComparison.Ordinal) && v.Parameters.Count > 0 && v.Parameters [0].ParameterType.Name == "IMyFooProtocol");
Assert.AreEqual (10, methodCount, "Async method count");
}
[Test]
public void StackOverflow20696157 ()
{
BuildFile (Profile.iOS, "sof20696157.cs");
}
[Test]
public void HyphenInName ()
{
BuildFile (Profile.iOS, "btouch-with-hyphen-in-name.cs");
}
[Test]
public void PropertyRedefinition ()
{
BuildFile (Profile.iOS, "property-redefination-ios.cs");
}
[Test]
public void ArrayFromHandleBug ()
{
BuildFile (Profile.iOS, "arrayfromhandlebug.cs");
}
[Test]
public void StrongDictSupportTemplatedDicts ()
{
BuildFile (Profile.iOS, "strong-dict-support-templated-dicts.cs");
}
[Test]
[Ignore ("Fails with: api.cs(10,17): error CS0246: The type or namespace name `CBUUID' could not be found. Are you missing `CoreBluetooth' using directive?")]
public void GenericStrongDictionary ()
{
BuildFile (Profile.iOS, "generic-strong-dictionary.cs");
}
[Test]
public void BindAsTests ()
{
BuildFile (Profile.iOS, "bindastests.cs");
}
[Test]
public void Forum54078 ()
{
var bgen = BuildFile (Profile.iOS, "forum54078.cs");
var api = bgen.ApiAssembly;
var type = api.MainModule.GetType ("Test", "CustomController");
foreach (var method in type.Methods)
Asserts.DoesNotThrowExceptions (method, type.FullName);
}
[Test]
public void Desk63279 ()
{
BuildFile (Profile.iOS, "desk63279A.cs", "desk63279B.cs");
}
[Test]
public void Desk79124 ()
{
var bgen = BuildFile (Profile.iOS, "desk79124.cs");
bgen.AssertType ("Desk79124.WYPopoverBackgroundView/WYPopoverBackgroundViewAppearance");
}
[Test]
public void MultipleApiDefinitions1 ()
{
BuildFile (Profile.iOS, "multiple-api-definitions1.cs");
}
[Test]
public void MultipleApiDefinitions2 ()
{
BuildFile (Profile.iOS, "multiple-api-definitions2-a.cs", "multiple-api-definitions2-b.cs");
}
[Test]
public void ClassNameCollision ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.Defines = BGenTool.GetDefaultDefines (bgen.Profile);
bgen.Sources.Add (Path.Combine (Configuration.SourceRoot, "tests", "generator", "classNameCollision-enum.cs"));
bgen.ApiDefinitions.Add (Path.Combine (Configuration.SourceRoot, "tests", "generator", "classNameCollision.cs"));
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void VirtualWrap ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("virtualwrap.cs");
bgen.CreateTemporaryBinding ();
bgen.ProcessEnums = true;
bgen.AssertExecute ("build");
// verify virtual methods
var attribs = MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.NewSlot;
bgen.AssertMethod ("WrapTest.MyFooClass", "FromUrl", attribs, null, "Foundation.NSUrl");
bgen.AssertMethod ("WrapTest.MyFooClass", "FromUrl", attribs, null, "System.String");
bgen.AssertMethod ("WrapTest.MyFooClass", "get_FooNSString", attribs | MethodAttributes.SpecialName, "Foundation.NSString");
bgen.AssertMethod ("WrapTest.MyFooClass", "get_FooString", attribs | MethodAttributes.SpecialName, "System.String");
// verify non-virtual methods
attribs = MethodAttributes.Public | MethodAttributes.HideBySig;
bgen.AssertMethod ("WrapTest.MyFooClass", "FromUrlN", attribs, null, "System.String");
bgen.AssertMethod ("WrapTest.MyFooClass", "get_FooNSStringN", attribs | MethodAttributes.SpecialName, "Foundation.NSString");
}
[Test]
public void NoAsyncInternalWrapper ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("noasyncinternalwrapper.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
var allTypes = bgen.ApiAssembly.MainModule.GetTypes ().ToArray ();
var allMembers = ((IEnumerable<MemberReference>) allTypes)
.Union (allTypes.SelectMany ((type) => type.Methods))
.Union (allTypes.SelectMany ((type) => type.Fields))
.Union (allTypes.SelectMany ((type) => type.Properties));
Assert.AreEqual (1, allMembers.Count ((member) => member.Name == "RequiredMethodAsync"), "Expected 1 RequiredMethodAsync members in generated code. If you modified code that generates RequiredMethodAsync (AsyncAttribute) please update the RequiredMethodAsync count.");
var attribs = MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig;
bgen.AssertMethod ("NoAsyncInternalWrapperTests.MyFooDelegate_Extensions", "RequiredMethodAsync", attribs, "System.Threading.Tasks.Task", "NoAsyncInternalWrapperTests.IMyFooDelegate", "System.Int32");
}
[Test]
public void NoAsyncWarningCS0219 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("noasyncwarningcs0219.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void FieldEnumTests ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.ProcessEnums = true;
bgen.AddTestApiDefinition ("fieldenumtests.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void SmartEnumWithFramework ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.ProcessEnums = true;
bgen.AddTestApiDefinition ("smartenumwithframework.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecute ("build");
bgen.AssertApiLoadsField ("SmartEnumWithFramework.FooEnumTestExtensions", "get_First", "ObjCRuntime.Libraries/CoreImage", "Handle", "First getter");
bgen.AssertApiLoadsField ("SmartEnumWithFramework.FooEnumTestExtensions", "get_Second", "ObjCRuntime.Libraries/CoreImage", "Handle", "Second getter");
}
[Test]
public void ForcedType ()
{
var bgen = BuildFile (Profile.iOS, false, "forcedtype.cs");
var allMethods = bgen.ApiAssembly.MainModule.GetTypes ().SelectMany ((type) => type.Methods);
// Count the number of calls to GetINativeObject
var getINativeObjectCalls = allMethods.Sum ((method) => {
if (!method.HasBody)
return 0;
return method.Body.Instructions.Count ((ins) => {
if (ins.OpCode.FlowControl != FlowControl.Call)
return false;
var mr = (MethodReference) ins.Operand;
return mr.Name == "GetINativeObject";
});
});
Assert.AreEqual (12, getINativeObjectCalls, "Preserve attribute count"); // If you modified code that generates PreserveAttributes please update the preserve count
}
BGenTool BuildFile (Profile profile, params string [] filenames)
{
return BuildFile (profile, true, filenames);
}
BGenTool BuildFile (Profile profile, bool nowarnings, params string [] filenames)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (bgen.Profile);
bgen.CreateTemporaryBinding (filenames.Select ((filename) => File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", filename))).ToArray ());
bgen.AssertExecute ("build");
if (nowarnings)
bgen.AssertNoWarnings ();
return bgen;
}
}
}

Просмотреть файл

@ -1,38 +1,69 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Xamarin.Utils;
namespace Xamarin.Tests
{
public enum Profile {
public enum Profile
{
None,
iOS,
tvOS,
iOS,
tvOS,
watchOS,
macClassic,
macModern,
macFull,
macSystem,
}
class BGenTool : Tool
{
AssemblyDefinition assembly;
public Profile Profile;
public bool ProcessEnums;
public List<string> ApiDefinitions = new List<string> ();
public List<string> Sources = new List<string> ();
public string [] Defines;
public string TmpDirectory;
public string ResponseFile;
public string WarnAsError; // Set to empty string to pass /warnaserror, set to non-empty string to pass /warnaserror:<nonemptystring>
public string NoWarn; // Set to empty string to pass /nowarn, set to non-empty string to pass /nowarn:<nonemptystring>
protected override string ToolPath { get { return Configuration.BGenPath; } }
protected override string MessagePrefix { get { return "BI"; } }
protected override string MessageToolName { get { return "bgen"; } }
public BGenTool ()
{
EnvironmentVariables = new Dictionary<string, string> {
{ "MD_MTOUCH_SDK_ROOT", Configuration.SdkRootXI },
{ "XamarinMacFrameworkRoot", Configuration.SdkRootXM },
};
}
public void AddTestApiDefinition (string filename)
{
ApiDefinitions.Add (Path.Combine (Configuration.SourceRoot, "tests", "generator", filename));
}
public AssemblyDefinition ApiAssembly {
get {
LoadAssembly ();
return assembly;
}
}
string BuildArguments ()
{
var sb = new StringBuilder ();
@ -68,10 +99,13 @@ namespace Xamarin.Tests
if (!string.IsNullOrEmpty (targetFramework))
sb.Append (" --target-framework=").Append (targetFramework);
foreach (var ad in ApiDefinitions)
sb.Append (" --api=").Append (StringUtils.Quote (ad));
foreach (var s in Sources)
sb.Append (" -s=").Append (StringUtils.Quote (s));
if (!string.IsNullOrEmpty (TmpDirectory))
sb.Append (" --tmpdir=").Append (StringUtils.Quote (TmpDirectory));
@ -81,12 +115,29 @@ namespace Xamarin.Tests
if (ProcessEnums)
sb.Append (" --process-enums");
if (Defines != null) {
foreach (var d in Defines)
sb.Append (" -d ").Append (StringUtils.Quote (d));
}
if (WarnAsError != null) {
sb.Append (" --warnaserror");
if (WarnAsError.Length > 0)
sb.Append (":").Append (StringUtils.Quote (WarnAsError));
}
if (NoWarn != null) {
sb.Append (" --nowarn");
if (NoWarn.Length > 0)
sb.Append (":").Append (StringUtils.Quote (NoWarn));
}
return sb.ToString ();
}
public void AssertExecute (string message)
{
Assert.AreEqual (0, Execute (BuildArguments ()), message);
Assert.AreEqual (0, Execute (BuildArguments (), always_show_output: true), message);
}
public void AssertExecuteError (string message)
@ -94,19 +145,154 @@ namespace Xamarin.Tests
Assert.AreNotEqual (0, Execute (BuildArguments ()), message);
}
public void AssertApiCallsMethod (string caller_namespace, string caller_type, string caller_method, string @called_method, string message)
{
var type = ApiAssembly.MainModule.GetType (caller_namespace, caller_type);
var method = type.Methods.First ((v) => v.Name == caller_method);
AssertApiCallsMethod (method, called_method, message);
}
public void AssertApiCallsMethod (MethodReference method, string called_method, string message)
{
var instructions = method.Resolve ().Body.Instructions;
foreach (var ins in instructions) {
if (ins.OpCode.FlowControl != FlowControl.Call)
continue;
var mr = ins.Operand as MethodReference;
if (mr == null)
continue;
if (mr.Name == called_method)
return;
}
Assert.Fail ($"Could not find any instructions calling {called_method} in {method.FullName}: {message}\n\t{string.Join ("\n\t", instructions)}");
}
public void AssertApiLoadsField (string caller_type, string caller_method, string declaring_type, string field, string message)
{
var type = ApiAssembly.MainModule.GetTypes ().First ((v) => v.FullName == caller_type);
var method = type.Methods.First ((v) => v.Name == caller_method);
AssertApiLoadsField (method, declaring_type, field, message);
}
public void AssertApiLoadsField (MethodReference method, string declaring_type, string field, string message)
{
var instructions = method.Resolve ().Body.Instructions;
foreach (var ins in instructions) {
if (ins.OpCode.Code != Code.Ldsfld && ins.OpCode.Code != Code.Ldfld)
continue;
var fr = ins.Operand as FieldReference;
if (fr == null)
continue;
if (fr.DeclaringType.FullName != declaring_type)
continue;
if (fr.Name == field)
return;
}
Assert.Fail ($"Could not find any instructions loading the field {declaring_type}.{field} in {method.FullName}: {message}\n\t{string.Join ("\n\t", instructions)}");
}
public void AssertPublicTypeCount (int count, string message = null)
{
LoadAssembly ();
var actual = assembly.MainModule.Types.Where ((v) => v.IsPublic || v.IsNestedPublic);
if (actual.Count () != count)
Assert.Fail ($"Expected {count} public type(s), found {actual} public type(s). {message}\n\t{string.Join ("\n\t", actual.Select ((v) => v.FullName).ToArray ())}");
}
public void AssertPublicMethodCount (string typename, int count, string message = null)
{
LoadAssembly ();
var t = assembly.MainModule.Types.FirstOrDefault ((v) => v.FullName == typename);
var actual = t.Methods.Count ((v) => {
if (v.IsPrivate || v.IsFamily || v.IsFamilyAndAssembly)
return false;
return true;
});
if (actual != count)
Assert.Fail ($"Expected {count} publicly accessible method(s) in {typename}, found {actual} publicly accessible method(s). {message}");
}
public void AssertType (string fullname, TypeAttributes? attributes = null, string message = null)
{
LoadAssembly ();
var allTypes = assembly.MainModule.GetTypes ().ToArray ();
var t = allTypes.FirstOrDefault ((v) => v.FullName == fullname);
if (t == null)
Assert.Fail ($"No type named '{fullname}' in the generated assembly. {message}\nList of types:\n\t{string.Join ("\n\t", allTypes.Select ((v) => v.FullName))}");
if (attributes != null)
Assert.AreEqual (attributes.Value, t.Attributes, $"Incorrect attributes for type {fullname}.");
}
public void AssertMethod (string typename, string method, string returnType = null, params string [] parameterTypes)
{
AssertMethod (typename, method, null, returnType, parameterTypes);
}
public void AssertMethod (string typename, string method, MethodAttributes? attributes = null, string returnType = null, params string [] parameterTypes)
{
LoadAssembly ();
var t = assembly.MainModule.Types.First ((v) => v.FullName == typename);
var m = t.Methods.FirstOrDefault ((v) => {
if (v.Name != method)
return false;
if (v.Parameters.Count != parameterTypes.Length)
return false;
for (int i = 0; i < v.Parameters.Count; i++)
if (v.Parameters [i].ParameterType.FullName != parameterTypes [i])
return false;
return true;
});
if (m == null)
Assert.Fail ($"No method '{method}' with signature '{string.Join ("', '", parameterTypes)}' was found.");
if (attributes.HasValue)
Assert.AreEqual (attributes.Value, m.Attributes, "Attributes for {0}", m.FullName);
}
void LoadAssembly ()
{
if (assembly == null)
assembly = AssemblyDefinition.ReadAssembly (Path.Combine (TmpDirectory, Path.GetFileNameWithoutExtension (ApiDefinitions [0]) + ".dll"));
}
void EnsureTempDir ()
{
if (TmpDirectory == null)
TmpDirectory = Cache.CreateTemporaryDirectory ();
}
public void CreateTemporaryBinding (string api_definition)
public void CreateTemporaryBinding (params string [] api_definition)
{
EnsureTempDir ();
var api = Path.Combine (TmpDirectory, "api.cs");
File.WriteAllText (api, api_definition);
ApiDefinitions.Add (api);
for (int i = 0; i < api_definition.Length; i++) {
var api = Path.Combine (TmpDirectory, $"api{i}.cs");
File.WriteAllText (api, api_definition [i]);
ApiDefinitions.Add (api);
}
WorkingDirectory = TmpDirectory;
}
public static string [] GetDefaultDefines (Profile profile)
{
switch (profile) {
case Profile.macFull:
case Profile.macModern:
case Profile.macSystem:
return new string [] { "MONOMAC", "XAMCORE_2_0" };
case Profile.macClassic:
return new string [] { "MONOMAC" };
case Profile.iOS:
return new string [] { "IOS", "XAMCORE_2_0" };
default:
throw new NotImplementedException (profile.ToString ());
}
}
}
}

Просмотреть файл

@ -1,5 +1,5 @@
using System;
using System.IO;
using NUnit.Framework;
using Xamarin.Tests;
@ -19,8 +19,185 @@ namespace GeneratorTests
bgen.AssertError (86, "A target framework (--target-framework) must be specified.");
}
[Test]
[TestCase (Profile.iOS)]
public void BI1036 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.ApiDefinitions.Add (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bi1036.cs"));
bgen.CreateTemporaryBinding ();
bgen.AssertExecuteError ("build");
bgen.AssertError (1036, "The last parameter in the method 'NS.Foo.Method' must be a delegate (it's 'System.String').");
}
[Test]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
[TestCase (Profile.macClassic)]
public void BI1037 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "protocol-duplicate-abstract-error.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1037, "The selector Identifier on type Derived is found multiple times with both read only and write only versions, with no read/write version.");
}
[Test]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
[TestCase (Profile.macClassic)]
public void BI1038 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "protocol-duplicate-method-diff-return.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1038, "The selector DoIt on type Derived is found multiple times with different return types.");
}
[Test]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
[TestCase (Profile.macClassic)]
public void BI1039 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "protocol-duplicate-method-diff-length.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1039, "The selector doit:itwith:more: on type Derived is found multiple times with different argument length 3 : 4.");
}
[Test]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
[TestCase (Profile.macClassic)]
public void BI1040 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "protocol-duplicate-method-diff-out.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1040, "The selector doit:withmore on type Derived is found multiple times with different argument out states on argument 1.");
}
[Test]
[TestCase (Profile.macFull)]
[TestCase (Profile.macModern)]
[TestCase (Profile.macClassic)]
public void BI1041 (Profile profile)
{
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "protocol-duplicate-method-diff-type.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertErrorPattern (1041, "The selector doit:with:more: on type Derived is found multiple times with different argument types on argument 2 - System.Int32 : .*Foundation.NSObject.");
}
[Test]
public void BI1046 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("bi1046.cs");
bgen.CreateTemporaryBinding ();
bgen.ProcessEnums = true;
bgen.AssertExecuteError ("build");
bgen.AssertError (1046, "The [Field] constant HMAccessoryCategoryTypeGarageDoorOpener cannot only be used once inside enum HMAccessoryCategoryType.");
}
[Test]
public void BI1048 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bindas1048error.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1048, "Unsupported type String decorated with [BindAs]");
}
[Test]
public void BI1049 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bindas1049error.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1049, "Could not unbox type String from NSNumber container used on member BindAs1049ErrorTests.MyFooClass.StringMethod decorated with [BindAs].");
}
[Test]
public void BI1050_model ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bindas1050modelerror.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1050, "[BindAs] cannot be used inside Protocol or Model types. Type: MyFooClass");
}
[Test]
public void BI1050_protocol ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bindas1050protocolerror.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1050, "[BindAs] cannot be used inside Protocol or Model types. Type: MyFooClass");
}
[Test]
public void BI1060 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug42855.cs")));
bgen.AssertExecute ("build");
bgen.AssertWarning (1060, "The Bug42855Tests.MyFooClass protocol is decorated with [Model], but not [BaseType]. Please verify that [Model] is relevant for this protocol; if so, add [BaseType] as well, otherwise remove [Model].");
}
[Test]
public void BI1061 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug57070.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertWarning (1061, "The attribute 'ObjCRuntime.iOSAttribute' found on 'SomeClass.DoSomething' is not a valid binding attribute. Please remove this attribute.");
}
[Test]
public void BI1112_Bug37527_WrongProperty ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("bug37527-wrong-property.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecuteError ("build");
bgen.AssertError (1112, "Property 'TestProperty' should be renamed to 'Delegate' for BaseType.Events and BaseType.Delegates to work.");
}
[Test]
public void BI1113_Bug37527_MissingProperty ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.AddTestApiDefinition ("bug37527-missing-property.cs");
bgen.CreateTemporaryBinding ();
bgen.AssertExecuteError ("build");
bgen.AssertError (1113, "BaseType.Delegates were set but no properties could be found. Do ensure that the WrapAttribute is used on the right properties.");
}
[Test]
public void BI1117 ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
@ -47,6 +224,36 @@ namespace Bug52570Tests {
bgen.AssertWarning (1117, "The SomeMethod member is decorated with [Static] and its container class Bug52570Tests.FooObject_Extensions is decorated with [Category] this leads to hard to use code. Please inline SomeMethod into Bug52570Tests.FooObject class.");
}
[Test]
public void BI1117_classinternal ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug52570classinternal.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void BI1117_methodinternal ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug52570methodinternal.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void BI1117_allowstaticmembers ()
{
var bgen = new BGenTool ();
bgen.Profile = Profile.iOS;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "bug52570allowstaticmembers.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
[Test]
public void BindAsNoMultidimensionalArrays ()
{
@ -237,5 +444,105 @@ namespace Bug57094 {
bgen.AssertExecuteError ("build");
bgen.AssertError (1014, "Unsupported type for Fields: byte[] for 'Bug57094.FooObject SomeField'.");
}
[Test]
[TestCase (Profile.iOS)]
[TestCase (Profile.macClassic)]
public void WarnAsError (Profile profile)
{
const string message = "The SomeMethod member is decorated with [Static] and its container class warnaserrorTests.FooObject_Extensions is decorated with [Category] this leads to hard to use code. Please inline SomeMethod into warnaserrorTests.FooObject class.";
{
// Enabled
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.WarnAsError = string.Empty;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "warnaserror.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1117, message);
}
{
// Disabled
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "warnaserror.cs")));
bgen.AssertExecute ("build");
bgen.AssertWarning (1117, message);
}
{
// Only 1116
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.WarnAsError = "1116";
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "warnaserror.cs")));
bgen.AssertExecute ("build");
bgen.AssertWarning (1117, message);
}
{
// Only 1117
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.WarnAsError = "1117";
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "warnaserror.cs")));
bgen.AssertExecuteError ("build");
bgen.AssertError (1117, message);
}
}
[Test]
[TestCase (Profile.iOS)]
[TestCase (Profile.macClassic)]
public void NoWarn (Profile profile)
{
const string message = "The SomeMethod member is decorated with [Static] and its container class nowarnTests.FooObject_Extensions is decorated with [Category] this leads to hard to use code. Please inline SomeMethod into nowarnTests.FooObject class.";
{
// Enabled
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.NoWarn = string.Empty;
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "nowarn.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
{
// Disabled
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "nowarn.cs")));
bgen.AssertExecute ("build");
bgen.AssertWarning (1117, message);
}
{
// Only 1116
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.NoWarn = "1116";
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "nowarn.cs")));
bgen.AssertExecute ("build");
bgen.AssertWarning (1117, message);
}
{
// Only 1117
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
bgen.NoWarn = "1117";
bgen.CreateTemporaryBinding (File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "generator", "nowarn.cs")));
bgen.AssertExecute ("build");
bgen.AssertNoWarnings ();
}
}
}
}

Просмотреть файл

@ -2,44 +2,11 @@ TOP=../..
include $(TOP)/Make.config
export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)
export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
#
# * Use [IOS|MAC]_TESTS for simple tests that just verify the code can compile / generate.
# To add such a test, just add the file, and add the name of the file (without extension) to [IOS|MAC]_TESTS.
#
# * Use [IOS|MAC]_CUSTOM_TESTS for more advanced tests that needs more validation.
# In this case you additionally need to add a target for the name of the test, with the
# your test logic.
#
IOS_CURRENT_DIR=$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current
IOS_GENERATOR = $(IOS_CURRENT_DIR)/bin/bgen /unsafe --target-framework=Xamarin.iOS,v1.0
IOS_TESTS = bug15283 bug15307 bug15799 bug16036 sof20696157 bug23041 bug27430 bug27428 bug34042 btouch-with-hyphen-in-name property-redefination-ios arrayfromhandlebug bug36457 bug39614 bug40282 bug17232 bug24078-ignore-methods-events strong-dict-support-templated-dicts bug43579 bindastests
IOS_CUSTOM_TESTS = forum54078 desk63279 desk79124 multiple-api-definitions1 multiple-api-definitions2 bug29493 classNameCollision bi1036 bug37527 bug27986 bug35176 bi1046 bindas1048error bindas1049error bindas1050modelerror bindas1050protocolerror virtualwrap bug42855 bug52570classinternal bug52570methodinternal bug52570allowstaticmembers bug42742 warnaserror nowarn noasyncinternalwrapper noasyncwarningcs0219 bug53076 bug53076withmodel bug57070 fieldenumtests smartenumwithframework
MAC_CURRENT_DIR=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
MAC_GENERATOR = $(MAC_CURRENT_DIR)/bin/bgen
MAC_CLASSIC_GENERATOR = $(MAC_CURRENT_DIR)/bin/bgen --target-framework=XamMac,v1.0
MAC_FULL_GENERATOR = $(MAC_CURRENT_DIR)/bin/bgen --target-framework=Xamarin.Mac,Version=v4.5,Profile=Full
MAC_MOBILE_GENERATOR = $(MAC_CURRENT_DIR)/bin/bgen --target-framework=Xamarin.Mac,Version=v2.0,Profile=Mobile
MAC_TESTS = bmac_smoke bmac-with-hyphen-in-name property-redefination-mac NSApplicationPublicEnsureMethods protocol-duplicate-abstract
MAC_CUSTOM_TESTS = bug31788 protocol-duplicate-abstract-error protocol-duplicate-method-diff-length protocol-duplicate-method-diff-out protocol-duplicate-method-diff-type protocol-duplicate-method-diff-return
ALL_TESTS =
ifdef INCLUDE_IOS
ALL_TESTS += $(IOS_TESTS) $(IOS_CUSTOM_TESTS)
endif
ifdef INCLUDE_MAC
ALL_TESTS += $(MAC_TESTS) $(MAC_CUSTOM_TESTS)
endif
all-local:: $(ALL_TESTS) run-unit-tests
all-local:: run-unit-tests
build-unit-tests:
$(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore $(TOP)/src/generator.sln
$(SYSTEM_XBUILD) generator-tests.csproj $(XBUILD_VERBOSITY)
$(SYSTEM_MSBUILD) generator-tests.csproj $(XBUILD_VERBOSITY)
run-unit-tests: build-unit-tests
rm -f .failed-stamp
@ -49,232 +16,6 @@ run-unit-tests: build-unit-tests
( xsltproc $(TOP)/tests/HtmlTransform.xslt TestResult.xml > index.html && \
echo "@MonkeyWrench: AddFile: $$PWD/index.html")
@[[ ! -e .failed-stamp ]]
$(MAC_TESTS):
$(if $(V),,@echo "$@";) $(MAC_CLASSIC_GENERATOR) -d=MONOMAC $@.cs
$(if $(V),,@echo "$@";) $(MAC_FULL_GENERATOR) -d=MONOMAC -d=XAMCORE_2_0 $@.cs
$(if $(V),,@echo "$@";) $(MAC_MOBILE_GENERATOR) -d=MONOMAC -d=XAMCORE_2_0 $@.cs
$(IOS_TESTS):
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@.cs
define ProtocolTestTemplate
$(1):
$(if $(V),,@echo "$$@";) $(MAC_CLASSIC_GENERATOR) -d=MONOMAC $(1).cs 2>&1 | grep BI$(2) > /dev/null
$(if $(V),,@echo "$$@";) $(MAC_FULL_GENERATOR) -d=MONOMAC -d=XAMCORE_2_0 $(1).cs 2>&1 | grep BI$(2) > /dev/null
$(if $(V),,@echo "$$@";) $(MAC_MOBILE_GENERATOR) -d=MONOMAC -d=XAMCORE_2_0 $(1).cs 2>&1 | grep BI$(2) > /dev/null
endef
$(eval $(call ProtocolTestTemplate,protocol-duplicate-abstract-error,1037))
$(eval $(call ProtocolTestTemplate,protocol-duplicate-method-diff-length,1039))
$(eval $(call ProtocolTestTemplate,protocol-duplicate-method-diff-out,1040))
$(eval $(call ProtocolTestTemplate,protocol-duplicate-method-diff-type,1041))
$(eval $(call ProtocolTestTemplate,protocol-duplicate-method-diff-return,1038))
define iOSErrorCodeTestTemplate
$(1):
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $(1).cs 2>&1 | grep BI$(2) > /dev/null
endef
$(eval $(call iOSErrorCodeTestTemplate,bindas1048error,1048))
$(eval $(call iOSErrorCodeTestTemplate,bindas1049error,1049))
$(eval $(call iOSErrorCodeTestTemplate,bindas1050modelerror,1050))
$(eval $(call iOSErrorCodeTestTemplate,bindas1050protocolerror,1050))
$(eval $(call iOSErrorCodeTestTemplate,bug42855,1060))
$(eval $(call iOSErrorCodeTestTemplate,bug57070,1061))
define iOSNoErrorCodesTestTemplate
$(1):
$(if $(V),,@echo "$@";) !($(IOS_GENERATOR) $(1).cs 2>&1 | grep BI$(2) > /dev/null)
endef
$(eval $(call iOSNoErrorCodesTestTemplate,bug52570classinternal,1117))
$(eval $(call iOSNoErrorCodesTestTemplate,bug52570methodinternal,1117))
$(eval $(call iOSNoErrorCodesTestTemplate,bug52570allowstaticmembers,1117))
classNameCollision:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@.cs -s:classNameCollision-enum.cs -tmpdir=$@.tmpdir
bug31788:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(MAC_CLASSIC_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@grep -q xamarin_IntPtr_objc_msgSend bug31788.tmpdir/Test/MarshalOnProperty.g.cs
@grep -q xamarin_IntPtr_objc_msgSend bug31788.tmpdir/Test/MarshalInProperty.g.cs
desk63279:
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) desk63279A.cs desk63279B.cs
desk79124:
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@.cs >/dev/null 2>&1
@if ! monodis $@.dll --typedef | grep WYPopoverBackgroundViewAppearance > /dev/null; then \
echo "error: Could not find WYPopoverBackgroundViewAppearance in generated code."; \
fi
forum54078:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@! grep "Type does not conform to NSCoding" forum54078.tmpdir/Test/CustomController.g.cs
multiple-api-definitions1:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
multiple-api-definitions2:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir --api=$@-a.cs --api=$@-b.cs
bug29493:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@! grep -r "static readonly IntPtr class_ptr = Class.GetHandle (\"global::" bug29493.tmpdir/Bug29493
bug37527:
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@-missing-property.cs | grep "BaseType.Delegates were set but no properties could be found. Do ensure that the WrapAttribute is used on the right properties." >/dev/null 2>&1
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@-wrong-property.cs | grep "should be renamed to 'Delegate' for BaseType.Events and BaseType.Delegates to work." >/dev/null 2>&1
bug27986:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if ! grep -r Preserve bug27986.tmpdir/bug27986 > /dev/null; then \
echo "error: Could not find Preserve attribute in generated code."; exit 1; \
fi
@if [ `grep -r Preserve bug27986.tmpdir/bug27986 | wc -l` -ne 28 ]; then \
echo "Error: Expected 28 Preserve attributes in generated code. If you modified code that generates PreserveAttributes please update the preserve count."; exit 1; \
fi
bug35176:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if ! grep -r Introduced bug35176.tmpdir/bug35176 > /dev/null; then \
echo "error: Could not find Introduced attribute in generated code."; exit 1; \
fi
@if [ `grep -r Introduced bug35176.tmpdir/bug35176 | wc -l` -ne 8 ]; then \
echo "Error: Expected 4 Introduced attributes in generated code."; exit 1; \
fi
bug46292:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs --process-enums
@if ! grep -r Obsolete bug46292.tmpdir/BindingTests > /dev/null; then \
echo "error: Could not find Obsolete attribute in generated code."; exit 1; \
fi
@if [ `grep -r Obsolete bug46292.tmpdir/BindingTests | wc -l` -ne 2 ]; then \
echo "Error: Expected 2 Obsolete attributes in generated code."; exit 1; \
fi
forcedtype:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if ! grep -r GetINativeObject forcedtype.tmpdir > /dev/null; then \
echo "error: Could not find GetINativeObject usage in generated code."; exit 1; \
fi
@if [ `grep -r GetINativeObject forcedtype.tmpdir | wc -l` -ne 12 ]; then \
echo "Error: Expected 12 GetINativeObject usages in generated code."; exit 1; \
fi
bi1036:
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@.cs | grep BI1036 >/dev/null 2>&1
bi1046:
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) $@.cs --process-enums | grep BI1046 >/dev/null 2>&1
virtualwrap:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs --process-enums
@if ! grep -r "public virtual" virtualwrap.tmpdir/WrapTest > /dev/null; then \
echo "error: Could not find public virtual keywords in generated code."; exit 1; \
fi
@if [ `grep -r "public virtual" virtualwrap.tmpdir/WrapTest | wc -l` -ne 4 ]; then \
echo "Error: Expected 4 virtual keywords in generated code."; exit 1; \
fi
bug42742:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if ! grep -r Advice bug42742.tmpdir/bug42742 > /dev/null; then \
echo "error: Could not find Advice attribute in generated code."; exit 1; \
fi
@if [ `grep -r Advice bug42742.tmpdir/bug42742 | wc -l` -ne 24 ]; then \
echo "Error: Expected 24 Advice attributes in generated code. If you modified code that generates PreserveAttributes please update the preserve count."; exit 1; \
fi
warnaserror:
$(if $(V),,@echo "iOS $@ Enabled";) $(IOS_GENERATOR) -d=XAMCORE_2_0 -warnaserror $@.cs | grep "error BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Disabled";) !($(IOS_GENERATOR) -d=XAMCORE_2_0 $@.cs | grep "error BI1117" > /dev/null 2>&1)
$(if $(V),,@echo "iOS $@ Disabled Warning Found";) $(IOS_GENERATOR) -d=XAMCORE_2_0 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Only 1116";) $(IOS_GENERATOR) -d=XAMCORE_2_0 -warnaserror:1116 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Only 1117";) $(IOS_GENERATOR) -d=XAMCORE_2_0 -warnaserror:1117 $@.cs | grep "error BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Enabled";) $(MAC_CLASSIC_GENERATOR) -warnaserror $@.cs | grep "error BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Disabled";) !($(MAC_CLASSIC_GENERATOR) $@.cs | grep "error BI1117" > /dev/null 2>&1)
$(if $(V),,@echo "macOS $@ Disabled Warning Found";) $(MAC_CLASSIC_GENERATOR) $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Only 1116";) $(MAC_CLASSIC_GENERATOR) -warnaserror:1116 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Only 1117";) $(MAC_CLASSIC_GENERATOR) -warnaserror:1117 $@.cs | grep "error BI1117" > /dev/null 2>&1
nowarn:
$(if $(V),,@echo "iOS $@ Enabled";) !($(IOS_GENERATOR) -d=XAMCORE_2_0 -nowarn $@.cs | grep "warning BI1117" > /dev/null 2>&1)
$(if $(V),,@echo "iOS $@ Disabled";) $(IOS_GENERATOR) -d=XAMCORE_2_0 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Disabled Warning Found";) $(IOS_GENERATOR) -d=XAMCORE_2_0 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Only 1116";) $(IOS_GENERATOR) -d=XAMCORE_2_0 -nowarn:1116 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "iOS $@ Only 1117";) !($(IOS_GENERATOR) -d=XAMCORE_2_0 -nowarn:1117 $@.cs | grep "warning BI1117" > /dev/null 2>&1)
$(if $(V),,@echo "macOS $@ Enabled";) !($(MAC_CLASSIC_GENERATOR) -nowarn $@.cs | grep "warning BI1117" > /dev/null 2>&1)
$(if $(V),,@echo "macOS $@ Disabled";) $(MAC_CLASSIC_GENERATOR) $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Disabled Warning Found";) $(MAC_CLASSIC_GENERATOR) $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Only 1116";) $(MAC_CLASSIC_GENERATOR) -nowarn:1116 $@.cs | grep "warning BI1117" > /dev/null 2>&1
$(if $(V),,@echo "macOS $@ Only 1117";) !($(MAC_CLASSIC_GENERATOR) -nowarn:1117 $@.cs | grep "warning BI1117" > /dev/null 2>&1)
noasyncinternalwrapper:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if [ `grep -r RequiredMethodAsync $@.tmpdir/NoAsyncInternalWrapperTests | wc -l` -ne 1 ]; then \
echo "Error: Expected 1 RequiredMethodAsync members in generated code. If you modified code that generates RequiredMethodAsync (AsyncAttribute) please update the RequiredMethodAsync count."; exit 1; \
fi
noasyncwarningcs0219:
$(if $(V),,@echo "$@";) !($(IOS_GENERATOR) $@.cs 2>&1 | grep "warning CS0219" > /dev/null 2>&1)
bug53076:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if [ `grep -r "Async (this IMyFooProtocol" $@.tmpdir/Bug53076Test | wc -l` -ne 10 ]; then \
echo "Error: Expected 10 'Async (this IMyFooProtocol' matches in generated code. If you modified code that generates extension FooRequiredMethodAsync (AsyncAttribute) please update the 'Async (this IMyFooProtocol' count."; exit 1; \
fi
bug53076withmodel:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs
@if [ `grep -r "Async (this IMyFooProtocol" $@.tmpdir/Bug53076WithModelTest | wc -l` -ne 10 ]; then \
echo "Error: Expected 10 'Async (this IMyFooProtocol' matches in generated code. If you modified code that generates extension FooRequiredMethodAsync (AsyncAttribute) please update the 'Async (this IMyFooProtocol' count."; exit 1; \
fi
fieldenumtests:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs --process-enums
smartenumwithframework:
@rm -Rf $@.tmpdir
@mkdir -p $@.tmpdir
$(if $(V),,@echo "$@";) $(IOS_GENERATOR) --sourceonly:$@.source -tmpdir=$@.tmpdir $@.cs --process-enums
@if [ `grep -r "Libraries.CoreImage.Handle" $@.tmpdir/SmartEnumWithFramework | wc -l` -ne 2 ]; then \
echo "Error: Expected 2 'Libraries.CoreImage.Handle'."; exit 1; \
fi
clean-local::
rm -f *.dll *.source
rm -Rf *.tmpdir
rm -Rf bin

Просмотреть файл

@ -18,4 +18,3 @@ public interface FooType<GenType>
[Export ("getBar:")]
GenType GetBar (string bar);
}

Просмотреть файл

@ -4,7 +4,7 @@ using Foundation;
namespace BindingTests {
[Obsolete ("Type level obsolete must also be copied")]
public enum HMAccessoryCategoryType : int {
[Field ("HMAccessoryCategoryTypeGarageDoorOpener")]
[Field ("HMAccessoryCategoryTypeGarageDoorOpener", "__Internal")]
GarageDoorOpener = 0,
[Obsolete ("Use GarageDoorOpener")]

Просмотреть файл

@ -34,5 +34,8 @@ namespace Bug53076Test {
[Export ("optionalReturnObj:completion:")]
bool OptionalReturnMethodObj (int arg1, Action<NSError,NSObject> err);
}
[BaseType (typeof (NSObject))]
interface RequiredReturnMethodObjResult {}
}

Просмотреть файл

@ -35,5 +35,8 @@ namespace Bug53076WithModelTest {
[Export ("optionalReturnObj:completion:")]
bool OptionalReturnMethodObj (int arg1, Action<NSError,NSObject> err);
}
[BaseType (typeof (NSObject))]
interface RequiredReturnMethodObjResult {}
}

Просмотреть файл

@ -30,6 +30,18 @@
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil">
<HintPath>..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb">
<HintPath>..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb">
<HintPath>..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks">
<HintPath>..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ErrorTests.cs" />
@ -47,6 +59,8 @@
<Link>StringUtils.cs</Link>
</Compile>
<Compile Include="GeneratorTests.cs" />
<Compile Include="BGenTests.cs" />
<Compile Include="Asserts.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

Просмотреть файл

@ -0,0 +1,18 @@
using Foundation;
using ObjCRuntime;
namespace Test
{
[StrongDictionary ("AdvertisementDataKeys")]
interface AdvertisementData {
// property under tests, the generator should create a compilable property
NSDictionary <CBUUID, NSData> ServiceData { get; set; }
}
[Static, Internal]
interface AdvertisementDataKeys {
[Field ("MyFooFieldA", "libFoo.a")]
NSString ServiceDataKey { get; }
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net461" />
<package id="NUnit" version="3.7.1" targetFramework="net461" />
<package id="NUnit.ConsoleRunner" version="3.5.0" targetFramework="net40" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.5.0" targetFramework="net461" />

Просмотреть файл

@ -16,13 +16,8 @@ namespace Test
[StrongDictionary ("AdvertisementDataKeys")]
interface AdvertisementData {
#if XAMCORE_2_0
// property under tests, the generator should create a compilable property
NSDictionary <CBUUID, NSData> ServiceData { get; set; }
#else
// ensure that the generator continues to work with classic
NSDictionary ServiceData { get; set; }
#endif
}
[Static, Internal]

Просмотреть файл

@ -587,17 +587,6 @@ namespace xharness
};
Tasks.Add (nunitExecutionMTouch);
var runBTouch = new MakeTask
{
Jenkins = this,
Platform = TestPlatform.iOS,
TestName = "BTouch tests",
Target = "all",
WorkingDirectory = Path.Combine (Harness.RootDirectory, "generator"),
Ignored = !IncludeBtouch,
};
Tasks.Add (runBTouch);
var buildGenerator = new MakeTask {
Jenkins = this,
TestProject = new TestProject (Path.GetFullPath (Path.Combine (Harness.RootDirectory, "..", "src", "generator.sln"))),