Debian Codegraph @

pkg/envars/eval_test.go

raw symbols SCIP
1 // Copyright (c) Bartłomiej Płotka @bwplotka
2 // Licensed under the Apache License 2.0.
3
4 package envarsscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/
5
6 import (
7 "bytesscip-go gomod github.com/golang/go/src go1.24.9 bytes/"
8 "contextscip-go gomod github.com/golang/go/src go1.24.9 context/"
9 "osscip-go gomod github.com/golang/go/src go1.24.9 os/"
10 "testingscip-go gomod github.com/golang/go/src go1.24.9 testing/"
11
12 "github.com/efficientgo/core/testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/"
13 )
14
15 func TestEvalscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/TestEval().(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
16 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("simple.env", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
17 b, err := osscip-go gomod github.com/golang/go/src go1.24.9 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.9 os/ReadFile().("testdata/simple.env")
18 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
19
20 e, err := EvalVariablesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EvalVariables().(
21 contextscip-go gomod github.com/golang/go/src go1.24.9 context/.TODOscip-go gomod github.com/golang/go/src go1.24.9 context/TODO().(),
22 bytesscip-go gomod github.com/golang/go/src go1.24.9 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.24.9 bytes/NewReader().(b),
23 "PATH="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("PATH"), // go executable has to be available.
24 "GOBIN=/home/something/bin",
25 "HOME="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("HOME"),
26 )
27 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
28 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, EnvSlicescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EnvSlice#{
29 "VAR1=with space 124", "VAR2=with space 124-yolo", "VAR3=with\\n\\nnewline",
30 }, e)
31 })
32 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("bingo.env", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
33 b, err := osscip-go gomod github.com/golang/go/src go1.24.9 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.9 os/ReadFile().("testdata/bingo.env")
34 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
35
36 e, err := EvalVariablesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EvalVariables().(
37 contextscip-go gomod github.com/golang/go/src go1.24.9 context/.TODOscip-go gomod github.com/golang/go/src go1.24.9 context/TODO().(),
38 bytesscip-go gomod github.com/golang/go/src go1.24.9 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.24.9 bytes/NewReader().(b),
39 "PATH="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("PATH"), // go executable has to be available.
40 "GOBIN=/home/something/bin",
41 "HOME="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("HOME"),
42 )
43 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
44 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, EnvSlicescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EnvSlice#{
45 "GOBIN=/home/something/bin",
46 "COPYRIGHT=/home/something/bin/copyright-v0.0.0-20210107100701-44cf59f65a1b",
47 "EMBEDMD=/home/something/bin/embedmd-v1.0.0",
48 "FAILLINT=/home/something/bin/faillint-v1.5.0",
49 "GOIMPORTS=/home/something/bin/goimports-v0.0.0-20200519204825-e64124511800",
50 "GOLANGCI_LINT=/home/something/bin/golangci-lint-v1.26.0",
51 "MDOX=/home/something/bin/mdox-v0.1.1-0.20201227133330-19093fdd9326",
52 "MISSPELL=/home/something/bin/misspell-v0.3.4",
53 "PROXY=/home/something/bin/proxy-v0.10.0",
54 }, e)
55 })
56 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("export.env", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
57 b, err := osscip-go gomod github.com/golang/go/src go1.24.9 os/.ReadFilescip-go gomod github.com/golang/go/src go1.24.9 os/ReadFile().("testdata/export.env")
58 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
59
60 e, err := EvalVariablesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EvalVariables().(
61 contextscip-go gomod github.com/golang/go/src go1.24.9 context/.TODOscip-go gomod github.com/golang/go/src go1.24.9 context/TODO().(),
62 bytesscip-go gomod github.com/golang/go/src go1.24.9 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.24.9 bytes/NewReader().(b),
63 "PATH="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("PATH"), // go executable has to be available.
64 "GOBIN=/home/something/bin",
65 "HOME="+osscip-go gomod github.com/golang/go/src go1.24.9 os/.Getenvscip-go gomod github.com/golang/go/src go1.24.9 os/Getenv().("HOME"),
66 )
67 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Okscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Ok().(t, err)
68 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, EnvSlicescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/EnvSlice#{"GOBIN=/home/something/bin", "PROXY=/home/something/bin/proxy-v0.10.0", "X=/home/something/bin/proxy-v0.12.0"}, e)
69 })
70
71 }
72
73 func TestMergeEnvSlicesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/TestMergeEnvSlices().(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
74 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("just base", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
75 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, []string{
76 "OPTION_A=1",
77 "OPTION_B=2",
78 "OPTION_C=",
79 "OPTION_D=\\n",
80 "OPTION_E=1",
81 "OPTION_F=2",
82 "OPTION_G=",
83 "OPTION_H=\n",
84 "OPTION_I=echo 'asd'",
85 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
86 }, MergeEnvSlicesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/MergeEnvSlices().([]string{
87 "OPTION_A=1",
88 "OPTION_B=2",
89 "OPTION_C=",
90 "OPTION_D=\\n",
91 "OPTION_E=1",
92 "OPTION_F=2",
93 "OPTION_G=",
94 "OPTION_H=\n",
95 "OPTION_I=echo 'asd'",
96 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
97 }))
98 })
99 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("just over", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
100 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, []string{
101 "OPTION_A=1",
102 "OPTION_B=2",
103 "OPTION_C=",
104 "OPTION_D=\\n",
105 "OPTION_E=1",
106 "OPTION_F=2",
107 "OPTION_G=",
108 "OPTION_H=\n",
109 "OPTION_I=echo 'asd'",
110 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
111 }, MergeEnvSlicesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/MergeEnvSlices().([]string{},
112 "OPTION_A=1",
113 "OPTION_B=2",
114 "OPTION_C=",
115 "OPTION_D=\\n",
116 "OPTION_E=1",
117 "OPTION_F=2",
118 "OPTION_G=",
119 "OPTION_H=\n",
120 "OPTION_I=echo 'asd'",
121 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
122 ))
123 })
124 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("same", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
125 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, []string{
126 "OPTION_A=1",
127 "OPTION_B=2",
128 "OPTION_C=",
129 "OPTION_D=\\n",
130 "OPTION_E=1",
131 "OPTION_F=2",
132 "OPTION_G=",
133 "OPTION_H=\n",
134 "OPTION_I=echo 'asd'",
135 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
136 }, MergeEnvSlicesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/MergeEnvSlices().([]string{
137 "OPTION_A=1",
138 "OPTION_B=2",
139 "OPTION_C=",
140 "OPTION_D=\\n",
141 "OPTION_E=1",
142 "OPTION_F=2",
143 "OPTION_G=",
144 "OPTION_H=\n",
145 "OPTION_I=echo 'asd'",
146 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
147 },
148 "OPTION_A=1",
149 "OPTION_B=2",
150 "OPTION_C=",
151 "OPTION_D=\\n",
152 "OPTION_E=1",
153 "OPTION_F=2",
154 "OPTION_G=",
155 "OPTION_H=\n",
156 "OPTION_I=echo 'asd'",
157 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
158 ))
159 })
160 t.Runscip-go gomod github.com/golang/go/src go1.24.9 testing/T#Run().("real with dups", func(t *testingscip-go gomod github.com/golang/go/src go1.24.9 testing/.Tscip-go gomod github.com/golang/go/src go1.24.9 testing/T#) {
161 testutilscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/.Equalsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/testutil`/Equals().(t, []string{
162 "OPTION_A=1",
163 "OPTION_B=2",
164 "OPTION_C=22",
165 "OPTION_D=\\n22",
166 "OPTION_E=122",
167 "OPTION_F=222",
168 "OPTION_G=22",
169 "OPTION_H=\n22",
170 "OPTION_I=echo 'asd'22",
171 "OPTION_J=postgres://localhost:5432/database?sslmode=disable22",
172 }, MergeEnvSlicesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/envars`/MergeEnvSlices().([]string{
173 "OPTION_A=1",
174 "OPTION_B=2",
175 "OPTION_C=",
176 "OPTION_G=",
177 "OPTION_H=\n",
178 "OPTION_H=\n",
179 "OPTION_H=\n",
180 "OPTION_H=\n",
181 "OPTION_J=postgres://localhost:5432/database?sslmode=disable",
182 },
183 "OPTION_C=22",
184 "OPTION_D=\\n22",
185 "OPTION_E=122",
186 "OPTION_F=222",
187 "OPTION_G=22",
188 "OPTION_H=\n",
189 "OPTION_H=\n",
190 "OPTION_H=\n",
191 "OPTION_H=\n22",
192 "OPTION_I=echo 'asd'22",
193 "OPTION_J=postgres://localhost:5432/database?sslmode=disable22",
194 ))
195 })
196
197 }