Debian Codegraph @

config_test.go

raw symbols SCIP
1 /*
2 Copyright The containerd 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 mainscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/
18
19 import "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
20
21 func TestReadConfigFromscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/TestReadConfigFrom().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
22 testcases := []struct {
23 name string
24 toml string
25 }{
26 {
27 name: "empty",
28 toml: `version="unstable"`,
29 },
30 {
31 name: "generator",
32 toml: `
33 version="unstable"
34 generator="go"
35 `,
36 },
37 {
38 name: "generators",
39 toml: `
40 version="unstable"
41 generators=["go"]
42 `,
43 },
44 }
45
46 for _, tc := range testcases {
47 t.Runscip-go gomod github.com/golang/go/src go1.13 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
48 c, err := readConfigFromscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/readConfigFrom().([]byte(tc.toml))
49 if err != nil {
50 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("err must be nil, but got %v", err)
51 }
52 if c.Generatorscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/config#Generator. == "go" {
53 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Generator must be cleared, but got %v", c.Generatorscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/config#Generator.)
54 }
55 if len(c.Generatorsscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/config#Generators.) != 1 || c.Generatorsscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/config#Generators.[0] != "go" {
56 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Generators must be [go], but got %v", c.Generatorsscip-go gomod github.com/containerd/protobuild . `github.com/containerd/protobuild`/config#Generators.)
57 }
58 })
59 }
60 }