testutils

package
v0.0.0-...-192809c Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCommand = func(name string, arg ...string) ([]byte, error) {
	cmd := exec.Command(name, arg...)
	return cmd.Output()
}

ExecCommand is a variable that holds the function to execute system commands. It can be replaced in tests to mock command execution.

Functions

func CreateSQLiteTestDB

func CreateSQLiteTestDB(t *testing.T, dbPath string, schema string, rows [][]interface{}, columns []string)

CreateSQLiteTestDB creates a test SQLite database with schema and test data

func NewTestLogger

func NewTestLogger() *utils.Logger

func SplitLines

func SplitLines(data []byte) [][]byte

Helper to split content into lines (handles different line endings)

func WriteTestRecord

func WriteTestRecord(t *testing.T, filepath string, record utils.Record)

WriteTestRecord writes a test record to a file

Types

type TestDataWriter

type TestDataWriter struct {
	Records []utils.Record
}

TestDataWriter implements utils.DataWriter for testing

func (*TestDataWriter) Close

func (w *TestDataWriter) Close() error

func (*TestDataWriter) WriteRecord

func (w *TestDataWriter) WriteRecord(record utils.Record) error

Jump to

Keyboard shortcuts

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