(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestMustLookupEnv(t *testing.T) { |
| 13 | t.Parallel() |
| 14 | |
| 15 | t.Run("OK", func(t *testing.T) { |
| 16 | t.Parallel() |
| 17 | |
| 18 | const ( |
| 19 | key = "MY_ENV" |
| 20 | value = "value" |
| 21 | ) |
| 22 | |
| 23 | //nolint can't use t.SetEnv in parallel tests. |
| 24 | os.Setenv(key, value) |
| 25 | |
| 26 | val := xunix.MustLookupEnv(key) |
| 27 | require.Equal(t, value, val) |
| 28 | }) |
| 29 | |
| 30 | t.Run("Panic", func(t *testing.T) { |
| 31 | t.Parallel() |
| 32 | |
| 33 | defer func() { |
| 34 | e := recover() |
| 35 | require.NotNil(t, e, "function should panic") |
| 36 | }() |
| 37 | _ = xunix.MustLookupEnv("ASDasdf") |
| 38 | }) |
| 39 | } |
nothing calls this directly
no test coverage detected