public void OverloadResolution_Block1() {
var scope = Context.EmptyScope;
var proc = new Proc(ProcKind.Proc, null, scope, new BlockDispatcher0(BlockSignatureAttributes.None, null, 0).
SetMethod(new BlockCallTarget0((x, y) => null)));
var arguments = new[] {
// 1.times
new CallArguments(Context, MO(scope), new[] { MO(1) }, RubyCallSignature.WithScope(0)),
// 1.times &nil
new CallArguments(Context, MO(scope), new[] { MO(1), MO(null) }, RubyCallSignature.WithScopeAndBlock(0)),
// 1.times &p
new CallArguments(Context, MO(1), new[] { MO(proc) }, RubyCallSignature.WithBlock(0)),
// obj.times &p
new CallArguments(Context, MO("foo"), new[] { MO(proc) }, RubyCallSignature.WithBlock(0)),
};
var results = new[] {
"Times2",
"Times1",
"Times3",
"Times4",
};
var metaBuilder = new MetaObjectBuilder(null);
for (int i = 0; i < arguments.Length; i++) {
RubyOverloadResolver resolver;
var bindingTarget = RubyMethodGroupInfo.ResolveOverload(
metaBuilder, arguments[i], "times", GetStaticMethods(typeof(OverloadsWithBlock), "Times*"), SelfCallConvention.SelfIsParameter,
false, out resolver
);
Assert(bindingTarget.Success);
Assert(bindingTarget.Overload.Name == results[i]);
}
}