Debian Codegraph @

pkg/util/util_test.go

raw symbols SCIP
1 /*
2 Copyright 2018 The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package utilscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/
18
19 import (
20 "reflectscip-go gomod github.com/golang/go/src go1.21 reflect/"
21 "testingscip-go gomod github.com/golang/go/src go1.21 testing/"
22 )
23
24 func TestCanonicalNamescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/TestCanonicalName().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
25
26 var tests = []struct {
27 input string
28 expected string
29 }{
30 {"k8s.io/api/core/v1.Pod", "io.k8s.api.core.v1.Pod"},
31 {"k8s.io/api/networking/v1/NetworkPolicy", "io.k8s.api.networking.v1.NetworkPolicy"},
32 {"k8s.io/api/apps/v1beta2.Scale", "io.k8s.api.apps.v1beta2.Scale"},
33 {"servicecatalog.k8s.io/foo/bar/v1alpha1.Baz", "io.k8s.servicecatalog.foo.bar.v1alpha1.Baz"},
34 }
35 for _, test := range tests {
36 if got := ToRESTFriendlyNamescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/ToRESTFriendlyName().(test.input); got != test.expected {
37 t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("ToRESTFriendlyName(%q) = %v", test.input, got)
38 }
39 }
40 }
41
42 type TestTypescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/TestType# struct{}
43
44 func TestGetCanonicalTypeNamescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/TestGetCanonicalTypeName().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
45
46 var tests = []struct {
47 input interface{}
48 expected string
49 }{
50 {TestTypescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/TestType#{}, "k8s.io/kube-openapi/pkg/util.TestType"},
51 {&TestTypescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/TestType#{}, "k8s.io/kube-openapi/pkg/util.TestType"},
52 }
53 for _, test := range tests {
54 if got := GetCanonicalTypeNamescip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util`/GetCanonicalTypeName().(test.input); got != test.expected {
55 t.Errorfscip-go gomod github.com/golang/go/src go1.21 testing/common#Errorf().("GetCanonicalTypeName(%q) = %v", reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21 reflect/TypeOf().(test.input), got)
56 }
57 }
58 }