Debian Codegraph @

bool_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 (
8 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
9 "stringsscip-go gomod github.com/golang/go/src go1.13 strings/"
10 "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
11 )
12
13 var boolTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests. = []struct {
14 wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where. string
15 inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:in. []string
16 fscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:f. bool
17 fcscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:fc. int
18 optscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:opt. bool
19 optcscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:optc. int
20 errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:err. string
21 }{
22 {
23 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
24 []string{},
25 false, 0,
26 false, 0,
27 "",
28 },
29 {
30 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
31 []string{"test", "-f", "--opt"},
32 true, 1,
33 true, 1,
34 "",
35 },
36 {
37 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
38 []string{"test", "--f", "--opt"},
39 true, 1,
40 true, 1,
41 "",
42 },
43 {
44 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
45 []string{"test", "-ff", "-f", "--opt", "--opt"},
46 true, 3,
47 true, 2,
48 "",
49 },
50 {
51 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
52 []string{"test", "--opt", "--opt=false"},
53 false, 0,
54 false, 2,
55 "",
56 },
57 {
58 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
59 []string{"test", "-f", "false"},
60 true, 1,
61 false, 0,
62 "",
63 },
64 {
65 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
66 []string{"test", "-f=false"},
67 true, 1,
68 false, 0,
69 "test: unknown option: -=\n",
70 },
71 {
72 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
73 []string{"test", "-f", "false"},
74 true, 1,
75 false, 0,
76 "",
77 },
78 }
79
80 func TestBoolscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/TestBool().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
81 for x, tt := range boolTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests. {
82 resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/reset().()
83 f := Boolscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Bool().('f')
84 opt := BoolLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/BoolLong().("opt", 0)
85 if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where., ":-") > 0 {
86 tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where. = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("#%d", x)
87 }
88
89 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().(tt.inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:in.)
90 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`/boolTests:err.); s != "" {
91 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`/boolTests:where., s)
92 }
93 if got, want := *f, tt.fscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:f.; got != want {
94 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got %v, want %v", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where., got, want)
95 }
96 if got, want := *opt, tt.optscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:opt.; got != want {
97 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got %v, want %v", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where., got, want)
98 }
99 if got, want := GetCountscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/GetCount().('f'), tt.fcscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:fc.; got != want {
100 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got %v, want %v", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where., got, want)
101 }
102 if got, want := GetCountscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/GetCount().("opt"), tt.optcscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:optc.; got != want {
103 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got %v, want %v", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolTests:where., got, want)
104 }
105 }
106 }