Beispiel #1
0
        public void BI1065()
        {
            var bgen = new BGenTool {
                Profile      = Profile.iOS,
                ProcessEnums = true
            };

            bgen.CreateTemporaryBinding(@"
using System;
using ObjCRuntime;
using Foundation;

namespace BI1065Errors
{
	[BaseType (typeof (NSObject))]
	interface C
	{
		// Can't put SEL into NSArray (SEL isn't an NSObject), so a Selector[] parameter/return value doesn't make sense
		[Export (""testSelectorArray:"")]
		void TestSelectorArray (Selector[] values);
	}
}");
            bgen.AssertExecuteError("build");
            bgen.AssertError(1065, "Unsupported parameter type 'ObjCRuntime.Selector[]' for the parameter 'values' in BI1065Errors.C.TestSelectorArray.");
            bgen.AssertErrorCount(1);
        }
Beispiel #2
0
        public void BI1066()
        {
            var bgen = new BGenTool {
                Profile      = Profile.iOS,
                ProcessEnums = true
            };

            bgen.CreateTemporaryBinding(@"
using System;
using ObjCRuntime;
using Foundation;

namespace BI1066Errors
{
	[BaseType (typeof (NSObject))]
	interface C
	{
		// Can't put SEL into NSArray (SEL isn't an NSObject), so a Selector[] parameter/return value doesn't make sense
		[Export (""testSelectorArrayReturnValue"")]
		Selector[] TestSelectorArrayReturnValue ();
	}
}");
            bgen.AssertExecuteError("build");
            bgen.AssertError(1066, "Unsupported return type 'ObjCRuntime.Selector[]' in BI1066Errors.C.TestSelectorArrayReturnValue.");
            bgen.AssertErrorCount(2);              // We show the same error twice.
        }
Beispiel #3
0
        public void BI1064()
        {
            var bgen = new BGenTool {
                Profile      = Profile.iOS,
                ProcessEnums = true
            };

            bgen.CreateTemporaryBinding(@"
using System;
using ObjCRuntime;
using Foundation;

namespace BI1064Errors
{
	[BaseType (typeof (NSObject))]
	interface C
	{
		[Export (""testINativeObjectArray:a:b:"")]
		void TestINativeObjectArray (int action, ref INativeObject[] refValues, out INativeObject[] outValues);

		[Export (""invalid1:a:"")]
		void TestInvalid1 (ref DateTime[] refInvalid, out DateTime[] outInvalid);

		[Export (""invalid2:a:"")]
		void TestInvalid2 (ref object[] refInvalid, out object[] outInvalid);

		[Export (""invalid3:a:"")]
		void TestInvalid3 (ref int[] refInvalid, out int[] outInvalid);

		[Export (""invalid4:a:"")]
		void TestInvalid4 (ref object refInvalid, out object outInvalid);

		[Export (""testINativeObject:a:b:"")]
		void TestINativeObject (int action, ref INativeObject refValue, out INativeObject outValue);

		[Export (""testSelectorArray:a:b:"")] // Can't put SEL into NSArray (SEL isn't an NSObject)
		void TestSelectorArray (int action, ref Selector[] refValues, out Selector[] outValues);
	}
}");
            bgen.AssertExecuteError("build");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.INativeObject' for the parameter 'refValue' in BI1064Errors.C.TestINativeObject.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.INativeObject' for the parameter 'outValue' in BI1064Errors.C.TestINativeObject.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.INativeObject[]' for the parameter 'refValues' in BI1064Errors.C.TestINativeObjectArray.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.INativeObject[]' for the parameter 'outValues' in BI1064Errors.C.TestINativeObjectArray.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.DateTime[]' for the parameter 'refInvalid' in BI1064Errors.C.TestInvalid1.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.DateTime[]' for the parameter 'outInvalid' in BI1064Errors.C.TestInvalid1.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Object[]' for the parameter 'refInvalid' in BI1064Errors.C.TestInvalid2.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Object[]' for the parameter 'refInvalid' in BI1064Errors.C.TestInvalid2.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Int32[]' for the parameter 'outInvalid' in BI1064Errors.C.TestInvalid3.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Int32[]' for the parameter 'outInvalid' in BI1064Errors.C.TestInvalid3.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Object' for the parameter 'refInvalid' in BI1064Errors.C.TestInvalid4.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'System.Object' for the parameter 'refInvalid' in BI1064Errors.C.TestInvalid4.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.Selector[]' for the parameter 'refValues' in BI1064Errors.C.TestSelectorArray.");
            bgen.AssertError(1064, "Unsupported ref/out parameter type 'ObjCRuntime.Selector[]' for the parameter 'outValues' in BI1064Errors.C.TestSelectorArray.");
            bgen.AssertErrorCount(14);
        }
Beispiel #4
0
        public void BI1067_1070()
        {
            BGenTool bgen = new BGenTool {
                Profile = Profile.iOS,
            };

            bgen.CreateTemporaryBinding(File.ReadAllText(Path.Combine(Configuration.SourceRoot, "tests", "generator", "tests", "diamond-protocol-errors.cs")));
            bgen.AssertExecuteError("build");
            bgen.AssertError(1067, "The type 'DiamondProtocol.A.C' is trying to inline the property 'P1' from the protocols 'DiamondProtocol.A.P1' and 'DiamondProtocol.A.P2', but the inlined properties don't share the same accessors ('DiamondProtocol.A.P1 P1' is read-only, while '$DiamondProtocol.A.P2 P1' is write-only).");
            bgen.AssertWarning(1068, "The type 'DiamondProtocol.D.C' is trying to inline the property 'P1' from the protocols 'DiamondProtocol.D.P1' and 'DiamondProtocol.D.P2', and the inlined properties use different selectors (P1.P1 uses 'pA', and P2.P1 uses 'pB'.");
            bgen.AssertError(1069, "The type 'DiamondProtocol.Y.C' is trying to inline the methods binding the selector 'm1:' from the protocols 'DiamondProtocol.Y.P1' and 'DiamondProtocol.Y.P2', using methods with different signatures ('Void M1(System.Int32)' vs 'Int32 M1(System.Boolean)').");
            bgen.AssertError(1070, "The type 'DiamondProtocol.C.C' is trying to inline the property 'P1' from the protocols 'DiamondProtocol.C.P1' and 'DiamondProtocol.C.P2', but the inlined properties are of different types ('DiamondProtocol.C.P1 P1' is int, while 'DiamondProtocol.C.P2 P1' is int).");
            bgen.AssertErrorCount(3);
            bgen.AssertWarningCount(1);
        }