seatgen: an identifier splits on ':' too, so want:version is a Go constant
The node-engine seat's enum value want:version must yield a parseable Go constant; ':' splits as '-', '_', '.' and a space do. No existing generated output changes (the generator's check of mesh-delivery-contracts is unchanged). Builds: design 47 H lead answer H-A-64 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -373,3 +373,14 @@ func TestBodiesAreTypesAndAcceptedKindsRideStreams(t *testing.T) {
|
||||
t.Errorf("index.js lacks the delivery stream's subject:\n%s", js)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAnIdentifierSplitsOnEverySeparator is H-A-64's check: an enum value such as `want:version` yields a parseable
|
||||
// Go identifier, `:` splitting as `-`, `_`, `.` and a space do.
|
||||
func TestAnIdentifierSplitsOnEverySeparator(t *testing.T) {
|
||||
for name, want := range map[string]string{"want:version": "WantVersion", "publish-part": "PublishPart",
|
||||
"step_id": "StepID", "a.b c": "ABC", "cap-mib": "CapMiB"} {
|
||||
if got := ident(name); got != want {
|
||||
t.Errorf("ident(%q) = %q, want %q", name, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ func pkgName(name string) string { return strings.ReplaceAll(name, "-", "") }
|
||||
// PreviewWritten, local-name → LocalName, id → ID.
|
||||
func ident(name string) string {
|
||||
var b strings.Builder
|
||||
for _, w := range strings.FieldsFunc(name, func(r rune) bool { return r == '-' || r == '_' || r == '.' || r == ' ' }) {
|
||||
for _, w := range strings.FieldsFunc(name, func(r rune) bool { return r == '-' || r == '_' || r == '.' || r == ' ' || r == ':' }) {
|
||||
switch w {
|
||||
case "id":
|
||||
b.WriteString("ID")
|
||||
|
||||
Reference in New Issue
Block a user