fix test_missing on Mono
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
-
import unittest
from iptest import is_cli, is_netcoreapp, run_test, skipUnlessIronPython
-
# set this flag to True to have the test trace progress
trace = False
@@ -30,6 +28,12 @@ if is_cli:
import System.Diagnostics as Diagnostics
from System.Reflection.Emit import OpCodes
+ try:
+ System.Type.IsByRefLike
+ supportsIsByRefLike = True
+ except AttributeError:
+ supportsIsByRefLike = False
+
def MakeArray(type, *values):
a = System.Array.CreateInstance(clr.GetClrType(type), len(values))
for i in range(len(values)):
@@ -141,7 +145,6 @@ def EmitArg(cg, arg):
else:
raise AssertionError("Unknown type", arg, base, tc)
-
def EmitTestMethod(tg, name, argType):
cg = tg.DefineMethod(name, Reflection.MethodAttributes.Public | Reflection.MethodAttributes.Static, str, argType)
pb = cg.mb.DefineParameter(1, Reflection.ParameterAttributes.In | Reflection.ParameterAttributes.Optional, "o");
@@ -207,6 +210,7 @@ def GenerateMethods(ag):
for ref in (system_assembly, mscorlib_assembly):
for t in ref.GetExportedTypes():
if t.ContainsGenericParameters or t.FullName in skipTypes: continue
+ if supportsIsByRefLike and t.IsByRefLike: continue
if trace: print(counter, t.FullName)
EmitTestMethod(tg, "Test_%d" % counter, t)
@@ -226,7 +230,6 @@ def TestCalls(t):
r = getattr(t, n)()
if trace: print(r)
-
@unittest.skipIf(is_netcoreapp, "TODO: figure out")
@skipUnlessIronPython()
class MissingTest(unittest.TestCase):
@@ -238,5 +241,4 @@ class MissingTest(unittest.TestCase):
ag.Save()
-
run_test(__name__)
