(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func (c *ExpandPathTestCase) Assert(t *testing.T) { |
| 37 | if c.currentUser != nil { |
| 38 | oldCurrentUser := currentUser |
| 39 | currentUser = c.currentUser |
| 40 | defer func() { currentUser = oldCurrentUser }() |
| 41 | } |
| 42 | |
| 43 | if c.lookupUser != nil { |
| 44 | oldLookupUser := lookupUser |
| 45 | lookupUser = c.lookupUser |
| 46 | defer func() { lookupUser = oldLookupUser }() |
| 47 | } |
| 48 | |
| 49 | got, err := ExpandPath(c.Path, c.Expand) |
| 50 | if err != nil || len(c.WantErr) > 0 { |
| 51 | assert.EqualError(t, err, c.WantErr) |
| 52 | } |
| 53 | assert.Equal(t, filepath.ToSlash(c.Want), filepath.ToSlash(got)) |
| 54 | } |
| 55 | |
| 56 | func TestExpandPath(t *testing.T) { |
| 57 | for desc, c := range map[string]*ExpandPathTestCase{ |
nothing calls this directly
no test coverage detected