testable

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskOne

func AskOne(in survey.Prompt, out interface{}, opts ...survey.AskOpt) error

AskOne is a function which can be used to intercept surveys in the cli and replace the survey with input from a test input stream NextSurveyInput should be set to a function which returns the next string to satisfy the input

func BeginTesting

func BeginTesting()

configures Testable functions to utilise testing hooks

func EndTesting

func EndTesting()

configures Testable functions to stop utilising testing hooks

func Fprintf

func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)

func NextFuncFromSlice

func NextFuncFromSlice(t *testing.T, inputs SurveyInputs, position *int) func() StringOrBool

A helper which produces a next function that will call t.Fatal if all the inputs are exhausted position is an int representing the index in input for the next survey input

func WithNextSurveyInputFunc

func WithNextSurveyInputFunc(next func() StringOrBool)

Configure this with a function that returns the next input required for a cli test

Types

type StringOrBool

type StringOrBool interface{}

use this type for survey inputs

type SurveyInputs

type SurveyInputs []StringOrBool

use this type for survey inputs

Jump to

Keyboard shortcuts

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