| 1 | package aipreflectscip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.23.0 testing/" |
| 5 | |
| 6 | "gotest.tools/v3/assertscip-go gomod gotest.tools/v3 v3.5.2 `gotest.tools/v3/assert`/" |
| 7 | ) |
| 8 | |
| 9 | func TestResourceTypeName_Validatescip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/TestResourceTypeName_Validate().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 10 | t.Parallelscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Parallel().() |
| 11 | for _, tt := range []struct { |
| 12 | name string |
| 13 | errorContains string |
| 14 | }{ |
| 15 | { |
| 16 | name: "pubsub.googleapis.com/Topic", |
| 17 | }, |
| 18 | { |
| 19 | name: "pubsub/Topic", |
| 20 | errorContains: "service name: must be a valid domain name", |
| 21 | }, |
| 22 | { |
| 23 | name: "pubsub.googleapis.com/topic", |
| 24 | errorContains: "type: must start with an upper-case letter", |
| 25 | }, |
| 26 | { |
| 27 | name: "pubsub.googleapis.com/Topic_2", |
| 28 | errorContains: "type: must be UpperCamelCase", |
| 29 | }, |
| 30 | } { |
| 31 | t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 32 | t.Parallelscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Parallel().() |
| 33 | if tt.errorContains != "" { |
| 34 | assertscip-go gomod gotest.tools/v3 v3.5.2 `gotest.tools/v3/assert`/.ErrorContainsscip-go gomod gotest.tools/v3 v3.5.2 `gotest.tools/v3/assert`/ErrorContains().(t, ResourceTypescip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/ResourceType#(tt.name).Validatescip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/ResourceType#Validate().(), tt.errorContains) |
| 35 | } else { |
| 36 | assertscip-go gomod gotest.tools/v3 v3.5.2 `gotest.tools/v3/assert`/.NilErrorscip-go gomod gotest.tools/v3 v3.5.2 `gotest.tools/v3/assert`/NilError().(t, ResourceTypescip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/ResourceType#(tt.name).Validatescip-go gomod go.einride.tech/aip . `go.einride.tech/aip/reflect/aipreflect`/ResourceType#Validate().()) |
| 37 | } |
| 38 | }) |
| 39 | } |
| 40 | } |