testutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides utilities for testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CapStdout

func CapStdout(out *io.Writer, f func()) string

CapStdout captures the stdout of the provided function

func LoadJson

func LoadJson(fname string, res any)

LoadJson loads a json file into a struct

func MakeDummyFile

func MakeDummyFile(name string)

MakeDummyFile creates a file with fake data in it

func NewApp

func NewApp(listf, loginf, closef func(*cli.Context) error) *cli.App

NewApp makes mock cli app (mirroring ghi's interface)

func Readfile

func Readfile(fname string) string

Reafile reads a file, thowing a fatal error if the read fails

func SetupIssueServer

func SetupIssueServer(data any) *httptest.Server

SetupIssueServer sets up a local server that serves fake data, simulating https://api.github.com/search/issues

Types

This section is empty.

Jump to

Keyboard shortcuts

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