-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25144 from sharkyze/configs/fix-looksLikeSentence…
…s-index-out-of-range config/name_values: fix index out of range in looksLikeSentences
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package configs | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_looksLikeSentences(t *testing.T) { | ||
tests := map[string]struct { | ||
args string | ||
want bool | ||
}{ | ||
"empty sentence": { | ||
args: "", | ||
want: false, | ||
}, | ||
"valid sentence": { | ||
args: "A valid sentence.", | ||
want: true, | ||
}, | ||
"valid sentence with an accent": { | ||
args: `A Valid sentence with an accent "é".`, | ||
want: true, | ||
}, | ||
} | ||
|
||
for name, tt := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
if got := looksLikeSentences(tt.args); got != tt.want { | ||
t.Errorf("looksLikeSentences() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |