Skip to content

change: Regenerate Tests#871

Merged
Insti merged 2 commits intoexercism:masterfrom
pgaspar:change-regenerate-tests
Oct 20, 2018
Merged

change: Regenerate Tests#871
Insti merged 2 commits intoexercism:masterfrom
pgaspar:change-regenerate-tests

Conversation

@pgaspar
Copy link
Copy Markdown
Member

@pgaspar pgaspar commented Oct 5, 2018

Update change tests to: 1.3.0 258c807

Update generator to use the standard error indicator.
Update solution to pass updated tests.

Update generator to use the standard error indicator.
Update solution to pass updated tests.
skip
assert_equal -1, Change.generate([5, 10], 3)
assert_raises(ArgumentError) do
Change.generate([5, 10], 3)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ArgumentError is probably OK here, but what about returning a subclass which is more descriptive?

skip
assert_equal -1, Change.generate([5, 10], 94)
assert_raises(ArgumentError) do
Change.generate([5, 10], 94)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ArgumentError is probably not appropriate here.
Maybe nil or a custom error?

skip
assert_equal -1, Change.generate([1, 2, 5], -5)
assert_raises(ArgumentError) do
Change.generate([1, 2, 5], -5)
Copy link
Copy Markdown
Contributor

@Insti Insti Oct 5, 2018

Choose a reason for hiding this comment

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

ArgumentError is reasonable here. 👍

(I don't think invalid input like this is something we should be testing for, but that's an unrelated issue. (and very much a matter of opinion.))

@pgaspar
Copy link
Copy Markdown
Member Author

pgaspar commented Oct 16, 2018

Hello @iHiD! Thank you for your review. Wanted us to deal with #870 before this one, that's why I took so long to answer.

I understand and agree with your points, but I have a question:

Given how all 3 of these "error cases" are specified on the canonical data as "expected": {"error": ...}, how do you typically differentiate between them in the change_case.rb file? Should I check for the test name using something like this?

@Insti
Copy link
Copy Markdown
Contributor

Insti commented Oct 16, 2018

I assume you meant @Insti there :)

Yeah you'll need to do something like that. Either check the test name or error text I guess.

@iHiD
Copy link
Copy Markdown
Member

iHiD commented Oct 16, 2018

Ah! I was confused :)

@pgaspar
Copy link
Copy Markdown
Member Author

pgaspar commented Oct 16, 2018

Oh no! Sorry @iHiD 😅 Wrote that in a hurry and didn't notice it!

@Insti Thanks 👍 I'll work on something soon.

@pgaspar
Copy link
Copy Markdown
Member Author

pgaspar commented Oct 19, 2018

@Insti I just pushed some tentative changes. I didn't follow your suggestions to the letter, but wanted to get your opinion regardless.

Please let me know what you think. I also appreciate suggestions for better error names 👍

@pgaspar pgaspar force-pushed the change-regenerate-tests branch from cb7ff87 to 6c023f5 Compare October 19, 2018 01:58
attr_reader :coins, :target

class NegativeTargetError < ArgumentError; end
class ImpossibleCombinationError < StandardError; end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really like these two 👍

Copy link
Copy Markdown
Contributor

@Insti Insti left a comment

Choose a reason for hiding this comment

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

I think this looks good and does everything it needs to do now.

@Insti
Copy link
Copy Markdown
Contributor

Insti commented Oct 19, 2018

Do you think this is ready to merge now @pgaspar ?

@pgaspar
Copy link
Copy Markdown
Member Author

pgaspar commented Oct 19, 2018

I think so @Insti! Thank you 👍

@Insti Insti merged commit 46af51e into exercism:master Oct 20, 2018
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Oct 20, 2018

Thanks for all your work on these @pgaspar ❤️

@pgaspar pgaspar deleted the change-regenerate-tests branch October 22, 2018 19:06
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

Successfully merging this pull request may close these issues.

3 participants