exercism / exercism/problem-specifications

Word Count: Apostrophe bug that users' submissions could plausibly include, that current tests won't detect

Offen
#1,977 3 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
new test case idea
Vorherrschende Sprache
Ruby
Sterne
358
Forks
563
Ø Merge
18 Std. 41 Min.
Gemergte PRs (30 T.)
2

Beschreibung

The current test suite for the [word-count exercise](https://github.com/exercism/problem-specifications/tree/main/exercises/word-count) 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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.