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

Tests for Robot Name not strict enough #35

Closed
vitoreiji opened this issue Oct 6, 2014 · 8 comments
Closed

Tests for Robot Name not strict enough #35

vitoreiji opened this issue Oct 6, 2014 · 8 comments

Comments

@vitoreiji
Copy link
Contributor

The robot-name/README.md specification states that robot name should conform to a format like

RX837 or BC811

That is, two letters and then three digits. Yet, the code that tests for this pattern is /\w{2}\d{3}/, which allows a string such as 0.2542346345724565 to pass the test.
I've checked how the tests for this exercise are implemented in a few other languages (perl5, haskell, lua) and they do enforce the two-letters-three-digits format, mostly by using [a-zA-Z] instead of \w.
I believe this is important because the tests should formalize the general idea provided by the README, where the specification is really not very specific, prompting learners to submit code that is unchallenging like my first submission to this exercise.

@kytrinyx
Copy link
Member

kytrinyx commented Oct 6, 2014

Nice catch. Would you be willing to submit a patch for the test suite? https://github.com/exercism/xruby

@vitoreiji
Copy link
Contributor Author

I just submitted a pull request addressing this issue. Let me know if there's anything I should improve before it can be merged.

@cbojar
Copy link

cbojar commented Oct 6, 2014

Don't we also need begin and end delimiters so it doesn't accept something like "asdsdvfverAD234dsghs./,!"?

@kytrinyx
Copy link
Member

kytrinyx commented Oct 6, 2014

Yeah, it would be good to have tests agains that case.

@vitoreiji
Copy link
Contributor Author

Hey, thanks!
I comitted the suggested changes to my fork. Not sure how to proceed now, this is my first time updating a pull request.
Cheers!

@kytrinyx
Copy link
Member

kytrinyx commented Oct 7, 2014

If you submitted changes to your fork, the PR will automatically be updated. Thanks!

kytrinyx added a commit that referenced this issue Oct 7, 2014
Addressing issue #35 - make robot-name tests more strict
kytrinyx added a commit that referenced this issue Oct 9, 2014
Addressing issue #35 - make robot-name tests more strict
@britishtea
Copy link

I think this issue can be closed, since #36 is closed as well.

@kytrinyx
Copy link
Member

Yepp, good catch, thanks.

gchan pushed a commit to gchan/xruby that referenced this issue Oct 18, 2016
update README.md with .json doc.
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

4 participants