Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTestSuite(testSuitePath string, name string)
- 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 LoadFirstFileWithExt(dir string, ext string) string
- func RemoveLineOrder(str1 string) string
- func ReplaceAllKeyByValue(originStr, key, value string) string
- func SplitCommand(command string) []string
- type TestSuite
Constants ¶
const ENV_EXT = ".env"
const INPUT_EXT = ".input"
const JSON_EXT = ".json"
const STDERR_EXT = ".stderr"
const STDOUT_EXT = ".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 CheckTestSuite ¶
/ checkTestSuite Check that the file corresponding to each suffix can appear only once
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 LoadFirstFileWithExt ¶
LoadFirstFileWithExt read the first file with extention 'ext' in 'dir' and return the content.
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 }
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>"