(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func (c *ExpandConfigPathTestCase) Assert(t *testing.T) { |
| 134 | if c.currentUser != nil { |
| 135 | oldCurrentUser := currentUser |
| 136 | currentUser = c.currentUser |
| 137 | defer func() { currentUser = oldCurrentUser }() |
| 138 | } |
| 139 | |
| 140 | if c.lookupConfigHome != nil { |
| 141 | oldLookupConfigHome := lookupConfigHome |
| 142 | lookupConfigHome = c.lookupConfigHome |
| 143 | defer func() { lookupConfigHome = oldLookupConfigHome }() |
| 144 | } |
| 145 | |
| 146 | got, err := ExpandConfigPath(c.Path, c.DefaultPath) |
| 147 | if err != nil || len(c.WantErr) > 0 { |
| 148 | assert.EqualError(t, err, c.WantErr) |
| 149 | } |
| 150 | assert.Equal(t, filepath.ToSlash(c.Want), filepath.ToSlash(got)) |
| 151 | } |
| 152 | |
| 153 | func TestExpandConfigPath(t *testing.T) { |
| 154 | os.Unsetenv("XDG_CONFIG_HOME") |
nothing calls this directly
no test coverage detected