Make CIdentifier return error strings

This commit is contained in:
Tim Hockin
2015-12-19 22:52:48 -08:00
parent d07328dc4a
commit 189d4a5159
5 changed files with 18 additions and 11 deletions

View File

@@ -119,8 +119,8 @@ func TestIsCIdentifier(t *testing.T) {
"A", "AB", "AbC", "A1", "_A", "A_", "A_B", "A_1", "A__1__2__B", "__123_ABC",
}
for _, val := range goodValues {
if !IsCIdentifier(val) {
t.Errorf("expected true for '%s'", val)
if msgs := IsCIdentifier(val); len(msgs) != 0 {
t.Errorf("expected true for '%s': %v", val, msgs)
}
}
@@ -132,7 +132,7 @@ func TestIsCIdentifier(t *testing.T) {
"#a#",
}
for _, val := range badValues {
if IsCIdentifier(val) {
if msgs := IsCIdentifier(val); len(msgs) == 0 {
t.Errorf("expected false for '%s'", val)
}
}