utils

package
v0.0.0-...-4316413 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package utils contains helper functions used across the project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFloat64

func GetFloat64(dict map[string]string, key string, warnings *[]string) float64

GetFloat64 returns the dict[key] or an empty uint64 if the entry doesn't exists

func GetString

func GetString(dict map[string]string, key string) string

GetString returns the dict[key] or an empty string if the entry doesn't exists

func GetStringInterface

func GetStringInterface(dict map[string]interface{}, key string) string

GetStringInterface returns the dict[key] or an empty string if the entry doesn't exists or the value is not a string

func GetUint64

func GetUint64(dict map[string]string, key string, warnings *[]string) uint64

GetUint64 returns the dict[key] or an empty uint64 if the entry doesn't exists

func ParseFakeExecCmdArgs

func ParseFakeExecCmdArgs() (string, []string)

ParseFakeExecCmdArgs parses the CLI's os.Args as passed by fakeExecCmd and returns the testRunName, and cmdList. Meant to be used from test functions that are called by a fakeExecCmd built with BuildFakeExecCmd.

Types

type ExecCmdFunc

type ExecCmdFunc = func(name string, arg ...string) *exec.Cmd

ExecCmdFunc is a function type that matches exec.Command's signature

func BuildFakeExecCmd

func BuildFakeExecCmd(testName string, testRunName string) ExecCmdFunc

BuildFakeExecCmd returns a fakeExecCmd for the testName and testRunName. See platform/platform_common_test.go for an example of how to use it to mock exec.Cmd in tests.

Jump to

Keyboard shortcuts

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