testutil

package
v0.0.0-...-89f4574 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testutil contains helpers for working with commands in tests.

Package testutil provides common functionality for tests across the CLI.

NOTE: this package is only for generic utilities that don't have dependencies on other packages in the CLI. For utilities specific to another CLI package foo, create a foo/test package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyLineContainsAll

func AnyLineContainsAll(output string, substrs ...string) bool

AnyLineContainsAll validates that some line of the output contains all the provided substrings.

func ContainsAll

func ContainsAll(s string, substrs ...string) bool

ContainsAll validates all provided substrs are contained in s.

func ContainsAny

func ContainsAny(s string, substrs ...string) bool

ContainsAny validates any of the provided substrs is contained in s.

func ContainsRow

func ContainsRow(s string, fields ...string) (bool, error)

ContainsRow validates that all provided fields appear, in order, in a tab-separated row in s.

func CreateTestCommand

func CreateTestCommand() *cobra.Command

CreateTestCommand create a Cobra command suitable for use in tests.

func Execute

func Execute(cmd *cobra.Command, args []string) (string, error)

Execute will execute the provided command with args and return the output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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