| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,6 +131,56 @@ public static string TestOverloadedObject(object o) | |||
| 131 | 131 | return "Got object"; | |
| 132 | 132 | } | |
| 133 | 133 | ||
| 134 | + public static string TestOverloadedObjectTwo(int a, int b) | ||
| 135 | + { | ||
| 136 | + return "Got int-int"; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public static string TestOverloadedObjectTwo(string a, string b) | ||
| 140 | + { | ||
| 141 | + return "Got string-string"; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public static string TestOverloadedObjectTwo(string a, int b) | ||
| 145 | + { | ||
| 146 | + return "Got string-int"; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public static string TestOverloadedObjectTwo(string a, object b) | ||
| 150 | + { | ||
| 151 | + return "Got string-object"; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public static string TestOverloadedObjectTwo(int a, object b) | ||
| 155 | + { | ||
| 156 | + return "Got int-object"; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public static string TestOverloadedObjectTwo(object a, int b) | ||
| 160 | + { | ||
| 161 | + return "Got object-int"; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public static string TestOverloadedObjectTwo(object a, object b) | ||
| 165 | + { | ||
| 166 | + return "Got object-object"; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public static string TestOverloadedObjectTwo(int a, string b) | ||
| 170 | + { | ||
| 171 | + return "Got int-string"; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + public static string TestOverloadedObjectThree(object a, int b) | ||
| 175 | + { | ||
| 176 | + return "Got object-int"; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public static string TestOverloadedObjectThree(int a, object b) | ||
| 180 | + { | ||
| 181 | + return "Got int-object"; | ||
| 182 | + } | ||
| 183 | + | ||
| 134 | 184 | public static bool TestStringOutParams(string s, out string s1) | |
| 135 | 185 | { | |
| 136 | 186 | s1 = "output string"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -790,3 +790,32 @@ def test_object_in_param(): | |||
| 790 | 790 | ||
| 791 | 791 | res = MethodTest.TestOverloadedObject("test") | |
| 792 | 792 | assert res == "Got object" | |
| 793 | + | ||
| 794 | + | ||
| 795 | + def test_object_in_multiparam(): | ||
| 796 | + """Test method with object multiparams behaves""" | ||
| 797 | + | ||
| 798 | + res = MethodTest.TestOverloadedObjectTwo(5, 5) | ||
| 799 | + assert res == "Got int-int" | ||
| 800 | + | ||
| 801 | + res = MethodTest.TestOverloadedObjectTwo(5, "foo") | ||
| 802 | + assert res == "Got int-string" | ||
| 803 | + | ||
| 804 | + res = MethodTest.TestOverloadedObjectTwo("foo", 7.24) | ||
| 805 | + assert res == "Got string-object" | ||
| 806 | + | ||
| 807 | + res = MethodTest.TestOverloadedObjectTwo("foo", "bar") | ||
| 808 | + assert res == "Got string-string" | ||
| 809 | + | ||
| 810 | + res = MethodTest.TestOverloadedObjectTwo("foo", 5) | ||
| 811 | + assert res == "Got string-int" | ||
| 812 | + | ||
| 813 | + res = MethodTest.TestOverloadedObjectTwo(7.24, 7.24) | ||
| 814 | + assert res == "Got object-object" | ||
| 815 | + | ||
| 816 | + | ||
| 817 | + def test_object_in_multiparam_exception(): | ||
| 818 | + """Test method with object multiparams behaves""" | ||
| 819 | + | ||
| 820 | + with pytest.raises(TypeError): | ||
| 821 | + MethodTest.TestOverloadedObjectThree("foo", "bar") | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments