Skip to content

Commit 49b79c4

Browse files
authored
Sync tests from exercise word count (#2630)
1 parent 2c296ac commit 49b79c4

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

exercises/practice/word-count/.meta/tests.toml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[61559d5f-2cad-48fb-af53-d3973a9ee9ef]
613
description = "count one word"
@@ -28,6 +35,11 @@ description = "normalize case"
2835

2936
[4185a902-bdb0-4074-864c-f416e42a0f19]
3037
description = "with apostrophes"
38+
include = false
39+
40+
[4ff6c7d7-fcfc-43ef-b8e7-34ff1837a2d3]
41+
description = "with apostrophes"
42+
reimplements = "4185a902-bdb0-4074-864c-f416e42a0f19"
3143

3244
[be72af2b-8afe-4337-b151-b297202e4a7b]
3345
description = "with quotations"
@@ -40,3 +52,6 @@ description = "multiple spaces not detected as a word"
4052

4153
[50176e8a-fe8e-4f4c-b6b6-aa9cf8f20360]
4254
description = "alternating word separators not detected as a word"
55+
56+
[6d00f1db-901c-4bec-9829-d20eb3044557]
57+
description = "quotation for word with apostrophe"

exercises/practice/word-count/src/test/java/WordCountTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ public void withApostrophes() {
117117
expectedWordCount.put("laugh", 1);
118118
expectedWordCount.put("then", 1);
119119
expectedWordCount.put("cry", 1);
120+
expectedWordCount.put("you're", 1);
121+
expectedWordCount.put("getting", 1);
122+
expectedWordCount.put("it", 1);
120123

121-
actualWordCount = wordCount.phrase("First: don't laugh. Then: don't cry.");
124+
actualWordCount = wordCount.phrase("'First: don't laugh. Then: don't cry. You're getting it.'");
122125
assertThat(actualWordCount).isEqualTo(expectedWordCount);
123126
}
124127

@@ -173,4 +176,14 @@ public void alternatingWordSeperatorsNotDetectedAsAWord() {
173176
assertThat(actualWordCount).isEqualTo(expectedWordCount);
174177
}
175178

179+
@Ignore("Remove to run test")
180+
@Test
181+
public void quotationForWordWithApostrophe() {
182+
expectedWordCount.put("can", 1);
183+
expectedWordCount.put("can't", 2);
184+
185+
actualWordCount = wordCount.phrase("can, can't, 'can't'");
186+
assertThat(actualWordCount).isEqualTo(expectedWordCount);
187+
}
188+
176189
}

0 commit comments

Comments
 (0)