Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Conversation

@aisk
Copy link
Contributor

@aisk aisk commented Jul 30, 2017

No description provided.

Copy link
Contributor

@trotterdylan trotterdylan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Just a couple small suggestions.

if raised := checkFunctionArgs(f, "pow", args, expectedTypes...); raised != nil {
return nil, raised
}
v := args[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just call return Pow(f, args[0], args[1]) instead?

{f: "ord", args: wrapArgs("foo"), wantExc: mustCreateException(ValueErrorType, "ord() expected a character, but string of length 3 found")},
{f: "ord", args: wrapArgs(NewUnicode("волн")), wantExc: mustCreateException(ValueErrorType, "ord() expected a character, but string of length 4 found")},
{f: "ord", args: wrapArgs(1, 2, 3), wantExc: mustCreateException(TypeErrorType, "'ord' requires 1 arguments")},
{f: "pow", args: wrapArgs(1), wantExc: mustCreateException(TypeErrorType, "'pow' requires 2 arguments")},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a couple more test cases, e.g. a negative exponent and a complex number

@aisk
Copy link
Contributor Author

aisk commented Sep 7, 2017

@trotterdylan Ready for review!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants