MCPcopy
hub / github.com/docker/compose / Test_EnvResolverWithCase

Function Test_EnvResolverWithCase

pkg/compose/envresolver_test.go:25–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func Test_EnvResolverWithCase(t *testing.T) {
26 tests := []struct {
27 name string
28 environment map[string]string
29 caseInsensitive bool
30 search string
31 expectedValue string
32 expectedOk bool
33 }{
34 {
35 name: "case sensitive/case match",
36 environment: map[string]string{
37 "Env1": "Value1",
38 "Env2": "Value2",
39 },
40 caseInsensitive: false,
41 search: "Env1",
42 expectedValue: "Value1",
43 expectedOk: true,
44 },
45 {
46 name: "case sensitive/case unmatch",
47 environment: map[string]string{
48 "Env1": "Value1",
49 "Env2": "Value2",
50 },
51 caseInsensitive: false,
52 search: "ENV1",
53 expectedValue: "",
54 expectedOk: false,
55 },
56 {
57 name: "case sensitive/nil environment",
58 environment: nil,
59 caseInsensitive: false,
60 search: "Env1",
61 expectedValue: "",
62 expectedOk: false,
63 },
64 {
65 name: "case insensitive/case match",
66 environment: map[string]string{
67 "Env1": "Value1",
68 "Env2": "Value2",
69 },
70 caseInsensitive: true,
71 search: "Env1",
72 expectedValue: "Value1",
73 expectedOk: true,
74 },
75 {
76 name: "case insensitive/case unmatch",
77 environment: map[string]string{
78 "Env1": "Value1",
79 "Env2": "Value2",
80 },
81 caseInsensitive: true,
82 search: "ENV1",

Callers

nothing calls this directly

Calls 1

envResolverWithCaseFunction · 0.85

Tested by

no test coverage detected