Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGraphQLResults = 100
	MaxCommentLength  = 65536
	DefaultPageSize   = 30
)

Constants for testing

Variables

This section is empty.

Functions

func AssertGoldenMatch

func AssertGoldenMatch(t *testing.T, goldenFile string, actual string)

AssertGoldenMatch compares output with golden file

func CaptureOutput

func CaptureOutput(fn func()) (stdout, stderr string)

CaptureOutput captures stdout and stderr from a function

func LoadGoldenFile

func LoadGoldenFile(t *testing.T, name string) []byte

LoadGoldenFile loads a golden file for comparison

func MockGitHubAPI

func MockGitHubAPI(t *testing.T) *httptest.Server

MockGitHubAPI creates a mock HTTP server for GitHub API testing

func WriteGoldenFile

func WriteGoldenFile(t *testing.T, name string, data []byte)

WriteGoldenFile writes a golden file (for updating test expectations)

Types

type TestComment

type TestComment struct {
	ID        int    `json:"id"`
	Body      string `json:"body"`
	Type      string `json:"type"` // "issue" or "review"
	User      string `json:"user"`
	CreatedAt string `json:"created_at"`
	Path      string `json:"path,omitempty"`
	Line      int    `json:"line,omitempty"`
}

TestComment represents a test comment structure

func CreateTestComments

func CreateTestComments() []TestComment

CreateTestComments creates a set of test comments for testing

Jump to

Keyboard shortcuts

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