Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions tests/generator/Asserts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

using NUnit.Framework;

namespace GeneratorTests
{
public static class Asserts
{
namespace GeneratorTests {
public static class Asserts {
public static void DoesNotThrowExceptions (MethodReference method, string message)
{
var instructions = method.Resolve ().Body.Instructions;
Expand Down
8 changes: 3 additions & 5 deletions tests/generator/BGenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@

using Xamarin.Tests;

namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class BGenTests
{
public class BGenTests {
// Removing the following variable might make running the unit tests in VSMac fail.
static Type variable_to_keep_reference_to_system_runtime_compilerservices_unsafe_assembly = typeof (System.Runtime.CompilerServices.Unsafe);

Expand Down Expand Up @@ -636,7 +634,7 @@ public void GH5416_method (Profile profile)
[TestCase (Profile.iOS)]
public void GH5416_setter (Profile profile)
{
Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform());
Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ());
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.AddTestApiDefinition ("ghissue5416a.cs");
Expand Down
13 changes: 5 additions & 8 deletions tests/generator/BGenTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@

using Xamarin.Utils;

namespace Xamarin.Tests
{
class BGenTool : Tool
{
namespace Xamarin.Tests {
class BGenTool : Tool {
public const string None = "None";
AssemblyDefinition assembly;

Expand Down Expand Up @@ -397,8 +395,7 @@ public static string [] GetDefaultDefines (Profile profile)

// This class will replace stdout/stderr with its own thread-static storage for stdout/stderr.
// This means we're capturing stdout/stderr per thread.
class ThreadStaticTextWriter : TextWriter
{
class ThreadStaticTextWriter : TextWriter {
[ThreadStatic]
static TextWriter current_writer;

Expand All @@ -411,7 +408,7 @@ class ThreadStaticTextWriter : TextWriter

public static void ReplaceConsole (StringBuilder sb)
{
lock (lock_obj) {
lock (lock_obj) {
if (counter == 0) {
original_stdout = Console.Out;
original_stderr = Console.Error;
Expand All @@ -424,7 +421,7 @@ public static void ReplaceConsole (StringBuilder sb)
}

public static void RestoreConsole ()
{
{
lock (lock_obj) {
current_writer.Dispose ();
current_writer = null;
Expand Down
10 changes: 4 additions & 6 deletions tests/generator/ErrorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

using Xamarin.Tests;

namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class ErrorTests
{
public class ErrorTests {
[Test]
[TestCase (Profile.iOS)]
public void BI0002 (Profile profile)
Expand Down Expand Up @@ -203,7 +201,7 @@ public void GH6863_property (Profile profile)
bgen.AssertError (1071, "The BindAs type for the member \"GH6863_property.MyFooClass.StringProp\" must be an array when the member's type is an array.");
}


[Test]
[TestCase (Profile.iOS)]
public void GH6863_method (Profile profile)
Expand All @@ -215,7 +213,7 @@ public void GH6863_method (Profile profile)
bgen.AssertExecuteError ("build");
bgen.AssertError (1072, "The BindAs type for the parameter \"id_test\" in the method \"GH6863_method.MyFooClass.StringMethod\" must be an array when the parameter's type is an array.");
}


[Test]
[TestCase (Profile.iOS)]
Expand Down
6 changes: 2 additions & 4 deletions tests/generator/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
using Xamarin.Tests;
using Xamarin.Utils;

namespace GeneratorTests
{
namespace GeneratorTests {
[TestFixture ()]
[Parallelizable (ParallelScope.All)]
public class BGen
{
public class BGen {
[Test]
[TestCase (Profile.iOS)]
public void ResponseFile (Profile profile)
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/NSApplicationPublicEnsureMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using ObjCRuntime;

namespace Test {
[BaseType (typeof (NSObject), Delegates=new string [] {"WeakDelegate"}, Events=new Type [] {typeof (SharedDelegate)})]
[BaseType (typeof (NSObject), Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (SharedDelegate) })]
public interface TestClass {
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }
Expand Down
22 changes: 9 additions & 13 deletions tests/generator/arrayfromhandlebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,24 @@

namespace AudioUnit {
// @interface AUParameterNode : NSObject
[BaseType (typeof(NSObject))]
interface AUParameterNode
{
[BaseType (typeof (NSObject))]
interface AUParameterNode {
}

// @interface AUParameterGroup : AUParameterNode <NSSecureCoding>
[BaseType (typeof(AUParameterNode))]
interface AUParameterGroup : INSSecureCoding
{
[BaseType (typeof (AUParameterNode))]
interface AUParameterGroup : INSSecureCoding {
[Export ("allParameters")]
AUParameter[] AllParameters { get; }
AUParameter [] AllParameters { get; }
}

// @interface AUParameter : AUParameterNode <NSSecureCoding>
[BaseType (typeof(AUParameterNode))]
interface AUParameter : INSSecureCoding
{
[BaseType (typeof (AUParameterNode))]
interface AUParameter : INSSecureCoding {
}

// Commenting this out "fixes" the problem
[BaseType (typeof(NSObject))]
interface AudioUnit
{
[BaseType (typeof (NSObject))]
interface AudioUnit {
}
}
6 changes: 3 additions & 3 deletions tests/generator/bi1036.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace NS {
[BaseType (typeof (NSObject))]
interface Foo {
[Export ("foo:")]
[Async (ResultTypeName="Result")]
void Method (string arg);
[Export ("foo:")]
[Async (ResultTypeName = "Result")]
void Method (string arg);
}
}
3 changes: 1 addition & 2 deletions tests/generator/bi1042.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using Foundation;

namespace BindingTests
{
namespace BindingTests {
public enum Tools {
[Field ("DoorOpener")]
DoorOpener,
Expand Down
3 changes: 1 addition & 2 deletions tests/generator/bi1046.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using Foundation;

namespace BindingTests
{
namespace BindingTests {
public enum HMAccessoryCategoryType {
[Field ("HMAccessoryCategoryTypeGarageDoorOpener")]
DoorOpener,
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/bi1059.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
[Protocol]
[Preserve (AllMembers = true)]
[Preserve (AllMembers = true)]
partial interface BI1059 {}
partial interface BI1059 { }
2 changes: 1 addition & 1 deletion tests/generator/bindas1048error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ interface MyFooClass {
[return: BindAs (typeof (string))]
[Export ("stringMethod:")]
NSString StringMethod (int arg1);

}
}
2 changes: 1 addition & 1 deletion tests/generator/bindas1049error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ interface MyFooClass {
[return: BindAs (typeof (string))]
[Export ("stringMethod:")]
NSNumber StringMethod (int arg1);

}
}
2 changes: 1 addition & 1 deletion tests/generator/bindas1050modelerror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ interface MyFooClass {
[return: BindAs (typeof (CAScroll? []))]
[Export ("getScrollArrayEnum2:")]
NSNumber [] GetScrollArrayFooEnumArray2 ([BindAs (typeof (CAScroll []))] NSNumber [] arg1);

}
}
2 changes: 1 addition & 1 deletion tests/generator/bindas1050protocolerror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ interface MyFooClass {
[return: BindAs (typeof (CAScroll? []))]
[Export ("getScrollArrayEnum2:")]
NSNumber [] GetScrollArrayFooEnumArray2 ([BindAs (typeof (CAScroll []))] NSNumber [] arg1);

}
}
8 changes: 3 additions & 5 deletions tests/generator/bmac-with-hyphen-in-name.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Foundation;

namespace Test
{
[BaseType (typeof (NSObject))]
interface TestBMACLib
{
namespace Test {
[BaseType (typeof (NSObject))]
interface TestBMACLib {
[Export ("addTwoRows:withSecond:")]
int Add (int first, int second);
}
Expand Down
6 changes: 2 additions & 4 deletions tests/generator/bmac_smoke.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Foundation;

namespace Test
{
namespace Test {
[BaseType (typeof (NSObject))]
interface TestBMACLib
{
interface TestBMACLib {
[Export ("addTwoRows:withSecond:")]
int Add (int first, int second);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/generator/bug15283.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
using UIKit;
using System.Runtime.InteropServices;

namespace BindingTests
{
delegate NSObject MyBlockToBind (NSObject[] keys);
namespace BindingTests {
delegate NSObject MyBlockToBind (NSObject [] keys);

[BaseType (typeof (NSObject))]
interface TestInterface {
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/bug15307.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ namespace BindingTests {

// error BI1018: btouch: No [Export] attribute on property MonoTouch.ObjCRuntime.INativeObject.Handle
[BaseType (typeof (UIPageViewController))]
interface MyPageViewController : IUIPageViewControllerDelegate, IUIPageViewControllerDataSource {
interface MyPageViewController : IUIPageViewControllerDelegate, IUIPageViewControllerDataSource {
}
}
2 changes: 1 addition & 1 deletion tests/generator/bug17232.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace xam.bug17232 {
[BaseType (typeof (NSObject))]
interface FieldsTest {

[Field ("MyFooFieldA", "libFoo.a")]
NSString FooFieldA { get; }

Expand Down
8 changes: 4 additions & 4 deletions tests/generator/bug23041.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using UIKit;

namespace Test {
[Model, BaseType (typeof (UIPopoverControllerDelegate))]
[Protocol]
public partial interface BindingMainTabBarControllerScreensHandler {
}
[Model, BaseType (typeof (UIPopoverControllerDelegate))]
[Protocol]
public partial interface BindingMainTabBarControllerScreensHandler {
}
}
4 changes: 2 additions & 2 deletions tests/generator/bug24078-ignore-methods-events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace Test {

[BaseType (typeof (NSObject),
Delegates=new string [] {"WeakDelegate"},
Events=new Type [] { typeof (UIPopoverPresentationControllerDelegate) })]
Delegates = new string [] { "WeakDelegate" },
Events = new Type [] { typeof (UIPopoverPresentationControllerDelegate) })]
public partial interface TestController {
[Export ("delegate", ArgumentSemantic.UnsafeUnretained)]
NSObject WeakDelegate { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions tests/generator/bug27428.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
using Foundation;
using UIKit;

namespace Foo.BindingBugs
{
namespace Foo.BindingBugs {
[BaseType (typeof (NSObject))]
interface Widget {
[Export ("doSomething:atIndex:")]
Expand Down
7 changes: 3 additions & 4 deletions tests/generator/bug27430.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
using Foundation;
using UIKit;

namespace Bug27430
{
namespace Bug27430 {
delegate void SomeHandler (int @int, string @string, NSError @namespace);
delegate void SomeHandler2 (NSDictionary[] @switch, string[] @case, NSError @namespace);
delegate void SomeHandler2 (NSDictionary [] @switch, string [] @case, NSError @namespace);

[BaseType (typeof (NSObject))]
interface Widget {
Expand Down Expand Up @@ -71,7 +70,7 @@ interface Widget {
UIView [] @foreach { get; [Bind ("foo3:")] set; }

[Export ("dont4")]
UIView [] @case {[Bind ("bar4")] get; [Bind ("foo4:")] set; }
UIView [] @case { [Bind ("bar4")] get; [Bind ("foo4:")] set; }

[Export ("dont")]
NSArray @void { get; }
Expand Down
11 changes: 5 additions & 6 deletions tests/generator/bug27986.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
using ObjCRuntime;
using System.Drawing;

namespace bug27986
{
namespace bug27986 {
interface IFooProtocol { }

[Model, Protocol, Preserve (AllMembers = true)]
[BaseType (typeof (NSObject))]
interface FooProtocol {

[Preserve]
[Export ("doSomething:atIndex:")]
void DoSomething (NSObject @object, int index);
Expand All @@ -31,11 +30,11 @@ interface FooProtocol {
NSObject Center2 { get; set; }
}


[BaseType (typeof (NSObject))]
[Preserve (AllMembers = true)]
interface Widget {

[Preserve (Conditional = true)]
[Export ("initWithElmo:")]
IntPtr Constructor (uint elmo);
Expand All @@ -48,7 +47,7 @@ interface Widget {
[Export ("center")]
NSObject Center { get; set; }

[Export("noCenter")]
[Export ("noCenter")]
PointF NoCenter { [Preserve (Conditional = true)] get; [Preserve] set; }

[Preserve]
Expand Down
Loading