Skip to content

Commit

Permalink
[tests] Recover BindAs test that got lost in merges. (#2786)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Sep 27, 2017
1 parent a615909 commit d0bb1c5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/mtouch/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,35 @@ public class C
}
}

[Test]
public void MT4170 ()
{
using (var mtouch = new MTouchTool ()) {
var code = @"
namespace NS {
using System;
using Foundation;
using ObjCRuntime;
class X : NSObject {
[Export (""a"")]
[return: BindAs (typeof (DateTime), OriginalType = typeof (NSNumber))]
DateTime A () { throw new NotImplementedException (); }
[Export (""b"")]
[return: BindAs (typeof (DateTime?), OriginalType = typeof (NSNumber))]
DateTime? B () { throw new NotImplementedException (); }
}
}";
mtouch.Linker = MTouchLinker.DontLink; // faster
mtouch.Registrar = MTouchRegistrar.Static;
mtouch.CreateTemporaryApp (extraCode: code, extraArg: "-debug");
mtouch.CreateTemporaryCacheDirectory ();
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (4170, "The registrar can't convert from 'System.DateTime' to 'Foundation.NSNumber' for the return value in the method NS.X.A.", "testApp.cs", 9);
mtouch.AssertError (4170, "The registrar can't convert from 'System.Nullable`1<System.DateTime>' to 'Foundation.NSNumber' for the return value in the method NS.X.B.", "testApp.cs", 12);
mtouch.AssertErrorCount (4 /* errors are duplicated */);
}
}

[Test]
public void MT4171 ()
{
Expand Down

0 comments on commit d0bb1c5

Please sign in to comment.