Skip to content

Commit

Permalink
Acronym: add underscore test case (#1436)
Browse files Browse the repository at this point in the history
Many regular expression libraries have a way to detect word boundaries,
but their definition of word characters includes underscores.

\b and \w metacharacters were designed to detect programming language keywords,
and it is a common mistake to use them to match words in natural languages.
  • Loading branch information
Alexander authored and sshine committed Jan 9, 2019
1 parent 0c769d4 commit cacf1f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion exercises/acronym/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exercise": "acronym",
"version": "1.6.0",
"version": "1.7.0",
"cases": [
{
"description": "Abbreviate a phrase",
Expand Down Expand Up @@ -68,6 +68,14 @@
"phrase": "Halley's Comet"
},
"expected": "HC"
},
{
"description": "underscore emphasis",
"property": "abbreviate",
"input": {
"phrase": "The Road _Not_ Taken"
},
"expected": "TRNT"
}
]
}
Expand Down

0 comments on commit cacf1f1

Please sign in to comment.