Files
Dominik Schulz 7281ca8ab4 [chore] Migrate to golangci-lint v2 (#3104)
* [chore] Migrate to golangci-lint v2

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issue

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Add more package comments.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix golangci-lint config and the remaining checks

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Use Go 1.24

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix container builds

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix more failing tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix test failure

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix another len assertion

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Move location tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix most remaining lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Only run XDG specific tests on linux

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Attempt to address on source of flaky failures

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-17 08:05:43 +02:00

33 lines
807 B
Go

package fossilfs
import (
"testing"
)
func TestWithPathOverride(t *testing.T) {
ctx := t.Context()
path := "/test/path"
ctx = withPathOverride(ctx, path)
if val, ok := ctx.Value(ctxKeyPathOverride).(string); !ok || val != path {
t.Errorf("Expected path %s, but got %v", path, val)
}
}
func TestGetPathOverride(t *testing.T) {
ctx := t.Context()
defaultPath := "/default/path"
// Test with no override
if path := getPathOverride(ctx, defaultPath); path != defaultPath {
t.Errorf("Expected default path %s, but got %s", defaultPath, path)
}
// Test with override
overridePath := "/override/path"
ctx = withPathOverride(ctx, overridePath)
if path := getPathOverride(ctx, defaultPath); path != overridePath {
t.Errorf("Expected override path %s, but got %s", overridePath, path)
}
}