problem-specifications
problem-specifications copied to clipboard
Word Count: Apostrophe bug that users' submissions could plausibly include, that current tests won't detect
The current test suite for the word-count exercise tests for words containing apostrophes, but the only examples used in the test cases themselves are words that only have one letter after the apostrophe (specifically, "can't" and "don't").
As a consequence, if a user implements code that doesn't correctly handle words with more than one letter after the apostrophe (like I did, with a regex that looked like /([a-z]+'[a-z]| ... )/) the tests will not identify the problem. There aren't a lot of English examples where this might cause miscounts - the only one I could think of was "m'lord"/"m'lady", other than fantasy stuff like "bat'leth"/"bat'leths" - but the thought process that got me there seems pretty plausible as a mistake others might make (I looked at the test cases, saw "don't" and "can't", and thought of "I'm" and "he's", and didn't think of "you're" and "they'll"), so it seems like something worth checking for in the test cases.
Seems like a pretty easy fix to update the "with apostrophes" test case to include a word like "you're" or whatever, I'm happy to submit a PR if it's agreed as worthwhile.
Seems like a pretty easy fix to update the "with apostrophes" test case to include a word like "you're" or whatever, I'm happy to submit a PR if it's agreed as worthwhile.
I like the suggestion. My only remark would be that it would have to be a new test case as test cases are immutable. We can discuss whether or not we want the new test case to supersede (reimplements in problem-specifications parlance) the current test case (I think we might).
Dang it, there's always a catch. Is there a documented procedure for creating a new test to replace an old one? I had a look but couldn't find anything - this section of CONTRIBUTING.md just says to submit a PR for the JSON file, but it doesn't give any details.
I could probably write up a test, give it a new uuid, and submit a PR with the new test where the old one was, but I don't want to waste anyone else's time if there's a proper procedure to go through that I should be following.
@rneilsen There is a section in the README that explains how to do this: https://github.com/exercism/problem-specifications#changing-tests