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(); }
public void NoAsyncWarningCS0219() { var bgen = new BGenTool(); bgen.Profile = Profile.iOS; bgen.AddTestApiDefinition("noasyncwarningcs0219.cs"); bgen.CreateTemporaryBinding(); bgen.AssertExecute("build"); bgen.AssertNoWarnings(); }
public void ResponseFile() { var bgen = new BGenTool(); bgen.CreateTemporaryBinding(""); bgen.ResponseFile = Path.Combine(Cache.CreateTemporaryDirectory(), "rspfile"); File.WriteAllLines(bgen.ResponseFile, new string [] { "--target-framework:Xamarin.iOS,v1.0" }); bgen.AssertExecute("response file"); bgen.AssertNoWarnings(); }
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(); }
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(); }
public void Bug31788(Profile profile) { var bgen = new BGenTool(); bgen.Profile = profile; 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_exception", "MarshalInProperty.Shared getter"); bgen.AssertApiCallsMethod("Test", "MarshalOnProperty", "get_Shared", "xamarin_IntPtr_objc_msgSend_exception", "MarshalOnProperty.Shared getter"); }
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); }
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(); } }
BGenTool BuildFile(Profile profile, bool nowarnings, bool processEnums, params string [] filenames) { var bgen = new BGenTool(); bgen.Profile = profile; bgen.ProcessEnums = processEnums; bgen.Defines = BGenTool.GetDefaultDefines(bgen.Profile); TestContext.Out.WriteLine(TestContext.CurrentContext.Test.FullName); foreach (var filename in filenames) { TestContext.Out.WriteLine($"\t{filename}"); } bgen.CreateTemporaryBinding(filenames.Select((filename) => File.ReadAllText(Path.Combine(Configuration.SourceRoot, "tests", "generator", filename))).ToArray()); bgen.AssertExecute("build"); if (nowarnings) { bgen.AssertNoWarnings(); } return(bgen); }
public void ResponseFile() { var bgen = new BGenTool(); bgen.CreateTemporaryBinding(""); bgen.ResponseFile = Path.Combine(Cache.CreateTemporaryDirectory(), "rspfile"); var arguments = new List <string> (); #if NET var targetFramework = TargetFramework.DotNet_6_0_iOS_String; var tf = TargetFramework.Parse(targetFramework); arguments.Add($"--baselib={Configuration.GetBaseLibrary (tf)}"); arguments.Add($"--attributelib={Configuration.GetBindingAttributePath (tf)}"); arguments.AddRange(Directory.GetFiles(Configuration.DotNet6BclDir, "*.dll").Select(v => $"-r:{v}")); #else var targetFramework = "Xamarin.iOS,v1.0"; #endif arguments.Add($"--target-framework={targetFramework}"); File.WriteAllLines(bgen.ResponseFile, arguments.ToArray()); bgen.AssertExecute("response file"); bgen.AssertNoWarnings(); }