(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestSetRoot(t *testing.T) { |
| 53 | t.Cleanup(func() { paths.SetRoot("") }) |
| 54 | |
| 55 | defaultData := paths.GetDataDir() |
| 56 | defaultConfig := paths.GetConfigDir() |
| 57 | defaultCache := paths.GetCacheDir() |
| 58 | |
| 59 | paths.SetRoot("/custom/root") |
| 60 | assert.Equal(t, filepath.Clean("/custom/root/data"), paths.GetDataDir()) |
| 61 | assert.Equal(t, filepath.Clean("/custom/root/config"), paths.GetConfigDir()) |
| 62 | assert.Equal(t, filepath.Clean("/custom/root/cache"), paths.GetCacheDir()) |
| 63 | |
| 64 | // Empty root restores the defaults. |
| 65 | paths.SetRoot("") |
| 66 | assert.Equal(t, defaultData, paths.GetDataDir()) |
| 67 | assert.Equal(t, defaultConfig, paths.GetConfigDir()) |
| 68 | assert.Equal(t, defaultCache, paths.GetCacheDir()) |
| 69 | } |
nothing calls this directly
no test coverage detected