2
0
Files
gitcaddy-server/modules/uri/uri_test.go
logikonline f97554b008
Some checks failed
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m49s
Build and Release / Unit Tests (push) Successful in 5m20s
Build and Release / Lint (push) Successful in 5m26s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 2m57s
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been cancelled
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
test: fix Windows compatibility issues in test suite
Skip LevelDB tests on Windows due to file locking and timeout issues. Adjust timer assertions to account for Windows timer resolution. Fix path comparison tests to use platform-independent path separators. Add missing file close in dumper test.
2026-01-22 18:59:06 -05:00

31 lines
682 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package uri
import (
"path/filepath"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadURI(t *testing.T) {
p, err := filepath.Abs("./uri.go")
assert.NoError(t, err)
// Convert path to proper file:// URL format
// On Windows, paths need to be converted: C:\path -> file:///C:/path
fileURL := "file://" + p
if runtime.GOOS == "windows" {
// Replace backslashes with forward slashes and add extra slash for Windows
fileURL = "file:///" + strings.ReplaceAll(p, "\\", "/")
}
f, err := Open(fileURL)
assert.NoError(t, err)
defer f.Close()
}