shared

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertError

func AssertError(t *testing.T, err error, context string)

AssertError checks that an error occurred

func AssertNoError

func AssertNoError(t *testing.T, err error, context string)

AssertNoError checks that no error occurred

func AssertStringContains

func AssertStringContains(t *testing.T, str, substr, context string)

AssertStringContains checks that a string contains a substring

func AssertStringNotContains

func AssertStringNotContains(t *testing.T, str, substr, context string)

AssertStringNotContains checks that a string does not contain a substring

func AssertURLsInOutput

func AssertURLsInOutput(t *testing.T, output string, expectedURLs []string)

AssertURLsInOutput checks if expected URLs are present in the output

func BuildTestBinary

func BuildTestBinary(t *testing.T) string

BuildTestBinary builds the urlmap binary for testing

func CreateBasicTestServer

func CreateBasicTestServer() *httptest.Server

CreateBasicTestServer creates a basic test server for testing

func CreateComplexSiteServer

func CreateComplexSiteServer() *httptest.Server

CreateComplexSiteServer creates a test server with a complex site structure

func CreateServerWithError

func CreateServerWithError(errorPaths []string) *httptest.Server

CreateServerWithError creates a test server that returns errors for certain paths

func CreateSlowServer

func CreateSlowServer(delay time.Duration) *httptest.Server

CreateSlowServer creates a test server with slow responses

func GetProjectRoot

func GetProjectRoot() string

GetProjectRoot returns the project root directory

func RunUrlmapCommand added in v0.2.0

func RunUrlmapCommand(binaryPath string, args ...string) (string, string, error)

RunUrlmapCommand runs the urlmap command with given arguments

Types

type TestEnvironment

type TestEnvironment struct {
	Server     *httptest.Server
	BinaryPath string
	TempDir    string
}

TestEnvironment represents a test environment setup

func SetupTestEnvironment

func SetupTestEnvironment(t *testing.T) *TestEnvironment

SetupTestEnvironment creates a complete test environment

func (*TestEnvironment) Cleanup

func (te *TestEnvironment) Cleanup()

Cleanup cleans up the test environment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL