libct/specconv: nits

1. Decapitalize errors.
2. Rename isValidName to checkPropertyName.
3. Make it return a specific error.

Suggested-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-11-17 17:30:03 -08:00
parent 20e928875a
commit 643f8a2b40
2 changed files with 15 additions and 15 deletions

View File

@@ -780,9 +780,9 @@ func TestIsValidName(t *testing.T) {
}
for _, tc := range testCases {
valid := isValidName(tc.in)
if valid != tc.valid {
t.Errorf("case %q: expected %v, got %v", tc.in, tc.valid, valid)
err := checkPropertyName(tc.in)
if (err == nil) != tc.valid {
t.Errorf("case %q: expected valid: %v, got error: %v", tc.in, tc.valid, err)
}
}
}
@@ -790,7 +790,7 @@ func TestIsValidName(t *testing.T) {
func BenchmarkIsValidName(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, s := range []string{"", "xx", "xxx", "someValidName", "A name", "Кир", "მადლობა", "合い言葉"} {
_ = isValidName(s)
_ = checkPropertyName(s)
}
}
}