Debian Codegraph @

list_test.go

raw symbols SCIP
1 // Copyright 2013 Google Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package getoptscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/
6
7 import "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
8
9 var listTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests. = []struct {
10 wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:where. string
11 inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:in. []string
12 lscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:l., listscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:list. []string
13 errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:err. string
14 }{
15 {
16 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
17 []string{},
18 nil, nil,
19 "",
20 },
21 {
22 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
23 []string{"test", "-l", "one"},
24 []string{"one"}, nil,
25 "",
26 },
27 {
28 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
29 []string{"test", "-lone", "-ltwo"},
30 []string{"one", "two"}, nil,
31 "",
32 },
33 {
34 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
35 []string{"test", "--list", "one"},
36 nil, []string{"one"},
37 "",
38 },
39 {
40 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
41 []string{"test", "--list=one", "--list=two"},
42 nil, []string{"one", "two"},
43 "",
44 },
45 {
46 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
47 []string{"test", "--list=one,two"},
48 nil, []string{"one", "two"},
49 "",
50 },
51 }
52
53 func TestListscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/TestList().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
54 for _, tt := range listTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests. {
55 resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/reset().()
56 l := Listscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/List().('l')
57 list := ListLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/ListLong().("list", 0)
58
59 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().(tt.inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:in.)
60 if s := checkErrorscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/checkError().(tt.errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:err.); s != "" {
61 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: %s", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:where., s)
62 }
63 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(*l, tt.lscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:l.) {
64 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got s = %q, want %q", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:where., *l, tt.lscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:l.)
65 }
66 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(*list, tt.listscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:list.) {
67 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got s = %q, want %q", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:where., *list, tt.listscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/listTests:list.)
68 }
69 }
70 }
71
72 func TestDefaultListscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/TestDefaultList().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
73 resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/reset().()
74 list := []string{"d1", "d2", "d3"}
75 ListVarscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/ListVar().(&list, 'l')
76 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().([]string{"test"})
77
78 want := []string{"d1", "d2", "d3"}
79 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(list, want) {
80 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("got s = %q, want %q", list, want)
81 }
82
83 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().([]string{"test", "-l", "one"})
84 want = []string{"one"}
85 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(list, want) {
86 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("got s = %q, want %q", list, want)
87 }
88
89 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().([]string{"test", "-l", "two"})
90 want = []string{"one", "two"}
91 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(list, want) {
92 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("got s = %q, want %q", list, want)
93 }
94 Lookupscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Lookup().('l').Resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option#Reset.()
95 want = []string{"d1", "d2", "d3"}
96 if badSlicescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/badSlice().(list, want) {
97 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("got s = %q, want %q", list, want)
98 }
99 }