Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joel-arthur opened this issue Sep 23, 2016 · 0 comments
Open

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

joel-arthur opened this issue Sep 23, 2016 · 0 comments

Comments

@joel-arthur
Copy link
Contributor

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 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant