chore: auto-commit (3 archivos)
- tool_create_function.go - naming.go - naming_test.go Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateName(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
kind string
|
||||
wantErr bool
|
||||
}{
|
||||
{"filter_slice", "function", false},
|
||||
{"bank_login", "function", false},
|
||||
{"metabase_get_dashboard", "function", false},
|
||||
{"sma", "function", false}, // acronym exception
|
||||
{"slice", "function", false}, // 'slice' is verb in allowlist
|
||||
{"data", "function", true}, // bare noun
|
||||
{"user", "function", true}, // bare noun
|
||||
{"foobarbaz", "function", true}, // unknown single token
|
||||
{"chat_panel", "component", false},
|
||||
{"result_go_core", "type", false},
|
||||
{"Slice", "function", true}, // not snake_case
|
||||
{"filter-slice", "function", true},
|
||||
{"", "function", true},
|
||||
}
|
||||
for _, c := range cases {
|
||||
err := validateName(c.name, c.kind)
|
||||
if (err != nil) != c.wantErr {
|
||||
t.Errorf("validateName(%q,%q) err=%v wantErr=%v", c.name, c.kind, err, c.wantErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateDomain(t *testing.T) {
|
||||
cases := []struct {
|
||||
domain string
|
||||
wantErr bool
|
||||
}{
|
||||
{"core", false},
|
||||
{"infra", false},
|
||||
{"viz", false},
|
||||
{"bogus", true},
|
||||
{"", true},
|
||||
{"Core", true},
|
||||
}
|
||||
for _, c := range cases {
|
||||
err := validateDomain(c.domain)
|
||||
if (err != nil) != c.wantErr {
|
||||
t.Errorf("validateDomain(%q) err=%v wantErr=%v", c.domain, err, c.wantErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user