Documentation ¶
Index ¶
- Constants
- Variables
- func CleanUpTestWorkspace() string
- func Copy(srcPath, dstPath string)
- func CopyDir(srcDir, dstDir string)
- func CreateTestWorkspace() string
- func Exec(cli string) (string, string, error)
- func ExecKpm(cli string) (string, error)
- func ExecKpmWithInDirWithEnv(cli, dir, env string) (string, string, error)
- func ExecKpmWithStdin(cli, dir, input string) (string, error)
- func ExecKpmWithWorkDir(cli, dir string) (string, string, error)
- func ExecWithWorkDir(cli, dir string) (string, error)
- func GetKpmCLIBin() string
- func GetWorkDir() string
- func GetWorkspace() string
- func IsIgnore(expectedStr string) bool
- func LoadFile(path string) string
- func RemoveLineOrder(str1 string) string
- func ReplaceAllKeyByValue(originStr, key, value string) string
- func SplitCommand(command string) []string
- type TestConf
- type TestSuite
Constants ¶
const CONF = "conf.json"
const ENV = "env"
const IGNORE = "ignore"
const INPUT = "input"
const STDERR = "stderr"
const STDOUT = "stdout"
const TEST_SUITES_DIR = "test_suites"
const TEST_WORKSPACE = "test_kpm_workspace"
Variables ¶
var KEYS = []string{"<workspace>", "<ignore>", "<un_ordered>", "<user_home>"}
Functions ¶
func CleanUpTestWorkspace ¶
func CleanUpTestWorkspace() string
CleanUpTestWorkspace will do 'rm -rf' to the "($pwd)/test_kpm_workspace".
func CreateTestWorkspace ¶
func CreateTestWorkspace() string
CreateTestWorkspace create an empty dir "($pwd)/test_kpm_workspace" for test kpm cli.
func ExecKpmWithInDirWithEnv ¶
ExecKpmWithInDirWithEnv executes kpm command in work directory with env.
func ExecKpmWithStdin ¶
ExecKpmWithStdin executes kpm command in work directory with stdin
func ExecKpmWithWorkDir ¶
ExecKpmWithWorkDir executes kpm command in work directory
func ExecWithWorkDir ¶
Exec execute common command
func IsIgnore ¶
IsIgnore will reture whether the expected result in 'expectedStr' should be ignored.
func RemoveLineOrder ¶
RemoveLineOrder will remove the line order in 'str1'.
func ReplaceAllKeyByValue ¶
ReplaceAllKeyByValue will replace all 'key's by 'value' in 'originStr'.
func SplitCommand ¶
SplitCommand will spilt command string into []string, but the string in quotes will not be cut. If 'command' is 'aaa bbb "ccc ddd"', SplitCommand will return ["aaa", "bbb", "ccc ddd"].
Types ¶
type TestSuite ¶
type TestSuite struct { Name string Envs string Input string ExpectStdout string ExpectStderr string Conf TestConf // contains filtered or unexported fields }
func LoadAllTestSuites ¶
LoadAllTestSuites load all test suites from 'getWorkDir()/test_suites'.
func LoadTestSuite ¶
LoadTestSuite load test suite from 'getWorkDir()/test_suites/name'.
func (*TestSuite) GetTestSuiteInfo ¶
GetTestSuiteInfo return a info for a test suite "<name>:<info>:<env>"