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

exercises(rna-transcription): remove untested RnaError #258

Merged
merged 4 commits into from
Mar 16, 2023

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Mar 13, 2023

For this exercise, I think this is better than adding a test for invalid input. We have enough exercises that do that. Then this exercise is more focused on practising using an allocator.

Closes: #214


Refs: #229

allocator.free(rna_slice);
return RnaError.IllegalDnaNucleotide;
},
else => unreachable,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this (unreachable) might be good to put in a HINTS.md file?

Copy link
Member Author

@ee7 ee7 Mar 15, 2023

Choose a reason for hiding this comment

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

Maybe, but unreachable isn't required here. The behavior is just unspecified, in both the instructions and tests.

For example, the user can just return on an unexpected character:

else => return rna_slice,

or skip that character, leaving it undefined:

else => continue,

or set a placeholder character:

else => rna_slice[i] = '_',

For the purposes of an example in this repo, I think unreachable is best - it signals to the maintainer that the behavior is untested.

But yes, I think it's a good idea to add a hint saying that the behavior is unspecified for an unexpected character. I'll do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done via instructions.append.md: ebab9a1

@ee7 ee7 force-pushed the exercises-rna-transcription-remove-RnaError branch from 839eba9 to ebab9a1 Compare March 16, 2023 11:11
@ee7 ee7 merged commit 794420a into exercism:main Mar 16, 2023
@ee7 ee7 deleted the exercises-rna-transcription-remove-RnaError branch March 16, 2023 11:30
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.

exercises(rna-transcription): has untested RnaError
2 participants