Beispiel #1
0
        public void BI1117()
        {
            var bgen = new BGenTool();

            bgen.Profile = Profile.iOS;
            bgen.CreateTemporaryBinding(@"using System;
using Foundation;

namespace Bug52570Tests {

	[Category]
	[BaseType (typeof (FooObject))]
	interface FooObject_Extensions {

		[Static]
		[Export (""someMethod:"")]
		bool SomeMethod (NSRange range);
	}

	[BaseType (typeof (NSObject))]
	interface FooObject {
	
	}
}");
            bgen.AssertExecute("build");
            bgen.AssertWarning(1117, "The member 'SomeMethod' 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.");
        }
Beispiel #2
0
        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].");
        }
Beispiel #3
0
        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.");
        }
Beispiel #4
0
        public void GH5416_setter()
        {
            var bgen = new BGenTool();

            bgen.Profile = Profile.iOS;
            bgen.AddTestApiDefinition("ghissue5416a.cs");
            bgen.CreateTemporaryBinding();
            bgen.AssertExecute("build");
            bgen.AssertWarning(1118, "[NullAllowed] should not be used on methods, like 'System.Void set_Setter(Foundation.NSString)', but only on properties, parameters and return values.");
        }
Beispiel #5
0
        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");
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public void NoWarn(Profile profile)
        {
            const string message = "The member 'SomeMethod' 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();
            }
        }