Skip to content

Python Issue - binding to check that an exception is thrown #63

Open
@joel-arthur

Description

@joel-arthur

It appears that binding affects the order parameters are passed into a function in python when you have optional parameters and a PosInfos param.

Here is some example code to show the problematic behavior:

import buddy.*;
using buddy.Should;
using haxe.PosInfos;

class Sandbox extends BuddySuite
{
    public function new()
    {
        describe("Bind",
        {
            it("should bind properly",{

                Sys.println("calling without bind");
                showBindProblem();

                Sys.println("\ncalling with bind");
                showBindProblem.bind().should.throwAnything();

                Sys.println("\ncalling with bind and an empty array");
                showBindProblem.bind([]).should.throwAnything();

            });
        });
    }

    private function showBindProblem(?args:Array<Dynamic>,?p:haxe.PosInfos)
    {
        Sys.println("args: " + args);
        Sys.println("p: " + p);
    }
}

This produces the following output:

calling without bind
args: null
p: { className : Sandbox, fileName : Sandbox.hx, lineNumber : 14, methodName : new }

calling with bind
args: { className : Sandbox, fileName : Sandbox.hx, lineNumber : 17, methodName : new }
p: null

calling with bind and an empty array
args: []
p: { className : Sandbox, fileName : Sandbox.hx, lineNumber : 20, methodName : new }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions