Skip to content

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

Merged
ee7 merged 4 commits into
exercism:mainfrom
ee7:exercises-rna-transcription-remove-RnaError
Mar 16, 2023
Merged

exercises(rna-transcription): remove untested RnaError#258
ee7 merged 4 commits into
exercism:mainfrom
ee7:exercises-rna-transcription-remove-RnaError

Conversation

@ee7

@ee7 ee7 commented Mar 13, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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?

@ee7 ee7 Mar 15, 2023

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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