| 1 | package config_testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | . "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/" |
| 7 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 8 | ) |
| 9 | |
| 10 | func TestEnvironmentGetDelegatesToFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/TestEnvironmentGetDelegatesToFetcher().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 11 | fetcher := MapFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/MapFetcher().(map[string][]string{ |
| 12 | "foo": []string{"bar", "baz"}, |
| 13 | }) |
| 14 | |
| 15 | env := EnvironmentOfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/EnvironmentOf().(fetcher) |
| 16 | val, ok := env.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("foo") |
| 17 | |
| 18 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 19 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "baz", val) |
| 20 | } |
| 21 | |
| 22 | func TestEnvironmentGetAllDelegatesToFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/TestEnvironmentGetAllDelegatesToFetcher().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 23 | fetcher := MapFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/MapFetcher().(map[string][]string{ |
| 24 | "foo": []string{"bar", "baz"}, |
| 25 | }) |
| 26 | |
| 27 | env := EnvironmentOfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/EnvironmentOf().(fetcher) |
| 28 | vals := env.GetAllscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#GetAll.("foo") |
| 29 | |
| 30 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []string{"bar", "baz"}, vals) |
| 31 | } |
| 32 | |
| 33 | func TestEnvironmentUnsetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/TestEnvironmentUnsetBoolDefault().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 34 | env := EnvironmentOfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/EnvironmentOf().(MapFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/MapFetcher().(nil)) |
| 35 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, env.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("unset", true)) |
| 36 | } |
| 37 | |
| 38 | func TestEnvironmentBoolTruthyConversionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/TestEnvironmentBoolTruthyConversion().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 39 | for _, c := range []EnvironmentConversionTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#{ |
| 40 | {"", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 41 | |
| 42 | {"true", true, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 43 | {"1", true, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 44 | {"on", true, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 45 | {"yes", true, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 46 | {"t", true, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(false)}, |
| 47 | |
| 48 | {"false", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(true)}, |
| 49 | {"0", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(true)}, |
| 50 | {"off", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(true)}, |
| 51 | {"no", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(true)}, |
| 52 | {"f", false, GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault.(true)}, |
| 53 | } { |
| 54 | c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Assert().(t) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func TestEnvironmentIntTestCasesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/TestEnvironmentIntTestCases().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 59 | for _, c := range []EnvironmentConversionTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#{ |
| 60 | {"", 1, GetIntDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault.(1)}, |
| 61 | |
| 62 | {"1", 1, GetIntDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault.(0)}, |
| 63 | {"3", 3, GetIntDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault.(0)}, |
| 64 | |
| 65 | {"malformed", 7, GetIntDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault.(7)}, |
| 66 | } { |
| 67 | c.Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Assert().(t) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | type EnvironmentConversionTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase# struct { |
| 72 | Valscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Val. string |
| 73 | Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Expected. interface{} |
| 74 | |
| 75 | GotFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#GotFn. func(env Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, key string) interface{} |
| 76 | } |
| 77 | |
| 78 | var ( |
| 79 | GetBoolDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault. = func(defscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:def. bool) func(e Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, key string) interface{} { |
| 80 | return func(escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:e. Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, keyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:key. string) interface{} { |
| 81 | return escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:e..Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.(keyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:key., defscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetBoolDefault:def.) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | GetIntDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault. = func(defscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:def. int) func(e Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, key string) interface{} { |
| 86 | return func(escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:e. Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, keyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:key. string) interface{} { |
| 87 | return escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:e..Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.(keyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:key., defscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/GetIntDefault:def.) |
| 88 | } |
| 89 | } |
| 90 | ) |
| 91 | |
| 92 | func (c *EnvironmentConversionTestCasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#) Assertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Assert().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 93 | fetcher := MapFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/MapFetcher().(map[string][]string{ |
| 94 | c.Valscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Val.: []string{c.Valscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Val.}, |
| 95 | }) |
| 96 | |
| 97 | env := EnvironmentOfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/EnvironmentOf().(fetcher) |
| 98 | got := c.GotFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#GotFn.(env, c.Valscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Val.) |
| 99 | |
| 100 | if c.Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Expected. != got { |
| 101 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("lfs/config: expected val=%q to be %q (got: %q)", c.Valscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Val., c.Expectedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config_test`/EnvironmentConversionTestCase#Expected., got) |
| 102 | } |
| 103 | } |