[mono/unit-tests] add callspec unit tests for different classs same prefix

Add a test that covers the case where a callspec method
descriptor has a class whose name is a prefix of the matched
class.
This commit is contained in:
Uri Simchoni 2017-09-18 16:26:54 +03:00
Родитель e4b94aa495
Коммит 59c42eacf4
2 изменённых файлов: 31 добавлений и 0 удалений

Просмотреть файл

@ -30,6 +30,18 @@ namespace Baz
}
}
class Foo2
{
public Foo2()
{
}
public string Bar(string greet)
{
return greet + ", World!!!";
}
}
class MainClass
{
public static void Main(string[] args)
@ -39,6 +51,8 @@ namespace Baz
System.Console.WriteLine(foo.Bar("World"));
var goo = new Goo();
System.Console.WriteLine(goo.Bar("Hello"));
var foo2 = new Foo2();
System.Console.WriteLine(foo2.Bar("Hello"));
}
}
}

Просмотреть файл

@ -22,6 +22,7 @@ enum test_method_enums {
FOO_BAR,
FOO_BARP,
GOO_BAR,
FOO2_BAR,
CONSOLE_WRITELINE,
};
@ -58,6 +59,7 @@ struct {
{FOO_BAR, "M:Baz.Foo:Bar", TRUE},
{FOO_BARP, "M:Baz.Foo:Bar", TRUE},
{GOO_BAR, "M:Baz.Foo:Bar", FALSE},
{FOO2_BAR, "M:Baz.Foo:Bar", FALSE},
{CONSOLE_WRITELINE, "M:Baz.Foo:Bar", FALSE},
{FOO_BAR, "all,-M:Baz.Foo:Bar", FALSE},
{CONSOLE_WRITELINE, "all,-M:Baz.Foo:Bar", TRUE},
@ -66,6 +68,7 @@ struct {
{FOO_BAR, "M::Bar", TRUE},
{FOO_BARP, "M::Bar", TRUE},
{GOO_BAR, "M::Bar", TRUE},
{FOO2_BAR, "M::Bar", TRUE},
{0, NULL, FALSE}};
@ -211,6 +214,20 @@ main (void)
}
g_array_append_val (test_methods, meth);
prog_klass = test_mono_class_from_name (prog_image, "Baz", "Foo2");
if (!prog_klass) {
res = 1;
printf ("FAILED FINDING Baz.Foo2\n");
goto out;
}
meth = mono_class_get_method_from_name (prog_klass, "Bar", 1);
if (!meth) {
res = 1;
printf ("FAILED FINDING Baz.Foo2:Bar (string)\n");
goto out;
}
g_array_append_val (test_methods, meth);
corlib = mono_get_corlib ();
console_klass = test_mono_class_from_name (corlib, "System", "Console");