Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add object overload test
  • Loading branch information
vmuriart committed Feb 22, 2017
commit b7a3c7ea18fa49d2977ed142e559e96f6ae6af55
15 changes: 15 additions & 0 deletions src/testing/methodtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ public static int[] TestOverloadedParams(int v, int[] args)
return args;
}

public static string TestOverloadedNoObject(int i)
{
return "Got int";
}

public static string TestOverloadedObject(int i)
{
return "Got int";
}

public static string TestOverloadedObject(object o)
{
return "Got object";
}

public static bool TestStringOutParams(string s, out string s1)
{
s1 = "output string";
Expand Down
22 changes: 22 additions & 0 deletions src/tests/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,3 +769,25 @@ def test_wrong_overload():
res = System.Math.Max(System.Double(50.5), 50.1)
assert res == 50.5
assert type(res) == float


def test_no_object_in_param():
"""Test that fix for #203 doesn't break behavior w/ no object overload"""

res = MethodTest.TestOverloadedNoObject(5)
assert res == "Got int"

with pytest.raises(TypeError):
MethodTest.TestOverloadedNoObject("test")


@pytest.mark.xfail(reason="Needs fixing. #203")
def test_object_in_param():
"""Test regression introduced by #151 in which Object method overloads
aren't being used. See #203 for issue."""

res = MethodTest.TestOverloadedObject(5)
assert res == "Got int"

res = MethodTest.TestOverloadedObject("test")
assert res == "Got object"