[tests] Refactor several tests to use new-style syntax.
Failure are reported much better, and the testing is more accurate and extensive.
This commit is contained in:
Родитель
84b6e8a405
Коммит
ed886f6181
|
@ -692,7 +692,14 @@ class X : ReplayKit.RPBroadcastControllerDelegate
|
|||
}
|
||||
}
|
||||
";
|
||||
Verify (R.Static, code, true);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: code, usings: "using System; using Foundation;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecute ();
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -919,7 +926,14 @@ class H : G {
|
|||
}
|
||||
";
|
||||
|
||||
Verify (R.Static, code, true);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: code, usings: "using Foundation;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecute ();
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
void Verify (R registrars, string code, bool success, params string [] expected_messages)
|
||||
|
@ -1047,7 +1061,14 @@ class Generic3<T> : NSObject where T: System.IConvertible {}
|
|||
";
|
||||
|
||||
// and the lack of warnings/errors in the new static registrar.
|
||||
Verify (R.Static, code, true);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: code, usings: "using Foundation; using UIKit;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecute ();
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1244,10 +1265,17 @@ class GenericMethodClass : NSObject {
|
|||
|
||||
}
|
||||
";
|
||||
Verify (R.Static, str1, false,
|
||||
".*Test.cs.*: error MT4113: The registrar found a generic method: 'GenericMethodClass.GenericMethod(T)'. Exporting generic methods is not supported, and will lead to random behavior and/or crashes",
|
||||
".*Test.cs.*: error MT4113: The registrar found a generic method: 'GenericMethodClass.Foo(T)'. Exporting generic methods is not supported, and will lead to random behavior and/or crashes"
|
||||
);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: str1, usings: "using Foundation;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecuteFailure ();
|
||||
mtouch.AssertError (4113, "The registrar found a generic method: 'GenericMethodClass.Foo(T)'. Exporting generic methods is not supported, and will lead to random behavior and/or crashes", "testApp.cs", 6);
|
||||
mtouch.AssertError (4113, "The registrar found a generic method: 'GenericMethodClass.GenericMethod(T)'. Exporting generic methods is not supported, and will lead to random behavior and/or crashes", "testApp.cs", 8);
|
||||
mtouch.AssertErrorCount (2);
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1259,7 +1287,14 @@ class GenericMethodClass : NSObject {
|
|||
public virtual void Foo (System.Action<string> func) {}
|
||||
}
|
||||
";
|
||||
Verify (R.Static, code, true);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: code, usings: "using Foundation;", extraArg: "/debug:full");
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.AssertExecute ();
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1369,7 +1404,14 @@ class CTP4 : CTP3 {
|
|||
public override bool ConformsToProtocol (IntPtr protocol) { return base.ConformsToProtocol (protocol); }
|
||||
}
|
||||
";
|
||||
Verify (R.Static, code, true);
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryCacheDirectory ();
|
||||
mtouch.CreateTemporaryApp (extraCode: code, usings: "using System; using Foundation;");
|
||||
mtouch.Registrar = MTouchRegistrar.Static;
|
||||
mtouch.Linker = MTouchLinker.DontLink;
|
||||
mtouch.AssertExecute ();
|
||||
mtouch.AssertNoWarnings ();
|
||||
}
|
||||
}
|
||||
|
||||
#region Helper functions
|
||||
|
|
Загрузка…
Ссылка в новой задаче