Debian Codegraph @

string_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 stringTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests. = []struct {
10 wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:where. string
11 inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:in. []string
12 soutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:sout. string
13 optoutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:optout. string
14 errscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:err. string
15 }{
16 {
17 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
18 []string{},
19 "one",
20 "two",
21 "",
22 },
23 {
24 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
25 []string{"test", "-s"},
26 "one",
27 "two",
28 "test: missing parameter for -s\n",
29 },
30 {
31 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
32 []string{"test", "--opt"},
33 "one",
34 "two",
35 "test: missing parameter for --opt\n",
36 },
37 {
38 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
39 []string{"test", "-svalue", "--opt=option"},
40 "value",
41 "option",
42 "",
43 },
44 {
45 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
46 []string{"test", "-s", "value", "--opt", "option"},
47 "value",
48 "option",
49 "",
50 },
51 {
52 locscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/loc().(),
53 []string{"test", "-swrong", "--opt=wrong", "-s", "value", "--opt", "option"},
54 "value",
55 "option",
56 "",
57 },
58 }
59
60 func TestStringscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/TestString().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
61 for _, tt := range stringTestsscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests. {
62 resetscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/reset().()
63 s := Stringscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/String().('s', "one")
64 opt := StringLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/StringLong().("opt", 0, "two")
65
66 parsescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/parse().(tt.inscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:in.)
67 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`/stringTests:err.); s != "" {
68 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`/stringTests:where., s)
69 }
70 if *s != tt.soutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:sout. {
71 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`/stringTests:where., *s, tt.soutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:sout.)
72 }
73 if *opt != tt.optoutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:optout. {
74 t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: got opt = %q, want %q", tt.wherescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:where., *opt, tt.optoutscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/stringTests:optout.)
75 }
76 }
77 }