Skip to content

phone-number 1.5.0.6: add cases to test data that cover invalid use of "1" or "0"#722

Merged
petertseng merged 1 commit intoexercism:masterfrom
sshine:phone-number-1.5.0.6
Sep 27, 2018
Merged

phone-number 1.5.0.6: add cases to test data that cover invalid use of "1" or "0"#722
petertseng merged 1 commit intoexercism:masterfrom
sshine:phone-number-1.5.0.6

Conversation

@sshine
Copy link
Copy Markdown
Contributor

@sshine sshine commented Sep 12, 2018

This should catch solutions with a validation function that calls itself recursively when the first digit is '1'.

Addresses exercism/problem-specifications#1325

Copy link
Copy Markdown
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

So! Since exercism/problem-specifications#1327 was taken instead, I suggest either using those cases. Or an option can be to leave it for another person to use those cases.

@sshine
Copy link
Copy Markdown
Contributor Author

sshine commented Sep 25, 2018

I'll adopt the new cases.

@sshine
Copy link
Copy Markdown
Contributor Author

sshine commented Sep 25, 2018

To go to version 1.6.0 of problem-specifications for phone-number seems to require us to use Either String instead of Maybe: exercism/problem-specifications@7290b84 -- I'm not sure where the decision for this should rest.

@NobbZ
Copy link
Copy Markdown
Member

NobbZ commented Sep 25, 2018

@sshine Why? How a specific error object from the spec is represented in the actual implementations is totally up to the track.

@sshine
Copy link
Copy Markdown
Contributor Author

sshine commented Sep 26, 2018

@NobbZ I said it seems like that, but I'm happy to know that individual tracks can disregard errors.

If we're going to keep the Maybes here, we can trivially bump phone-number to 1.6.0.7.

@sshine sshine changed the title phone-number 1.5.0.6: invalid when 12 digits and starting with 11 phone-number 1.5.0.6: add cases to test data that cover invalid use of "1" or "0" Sep 26, 2018
Copy link
Copy Markdown
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

This is, as far as I can see, the correct thing to do for 1.5.0, so we should merge this.

1.6.0: Does the student learn anything more interesting if required to distinguish the different sorts of errors that could occur?

If yes, should use Either. Some possible types to use for the Left would probably be:

  • discriminated union
  • the leftmost invalid character and the position at which it occurs

I'd advise against using a String as Left type.

If no, should use Maybe.

@petertseng petertseng merged commit 491f9f8 into exercism:master Sep 27, 2018
@sshine
Copy link
Copy Markdown
Contributor Author

sshine commented Oct 4, 2018

I think we should keep to Maybe and think of a good gradient point for using Either as error handling.

I agree with your points.

@sshine sshine deleted the phone-number-1.5.0.6 branch November 7, 2018 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants