/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/plugins/filepath_test.go
39 строк
924 B
Will Browne
Plugins: Remove `pkg/infra/fs`, `pkg/infra/tracing` and `pkg/infra/process` dependencies from pkg/plugins (#115798)
05 янв 2026, 14:12
Не верифицирован
05 янв 2026, 14:12
70b1053
Код
Авторство
О чём код?
package plugins import ( "path/filepath" "testing" "github.com/stretchr/testify/assert" ) func TestCleanRelativePath(t *testing.T) { testcases := []struct { input string expectedPath string }{ { input: "", expectedPath: ".", }, { input: filepath.Join(string(filepath.Separator), "test", "test.txt"), expectedPath: filepath.Join("test", "test.txt"), }, { input: filepath.Join("..", "..", "test", "test.txt"), expectedPath: filepath.Join("test", "test.txt"), }, { // since filepath.Join will remove the leading dot, we need to build the path manually input: "." + string(filepath.Separator) + filepath.Join("..", "test", "test.txt"), expectedPath: filepath.Join("test", "test.txt"), }, } for _, tt := range testcases { path, err := CleanRelativePath(tt.input) assert.NoError(t, err) assert.Equal(t, tt.expectedPath, path) } }