utils

package
v2.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallGenerator

func CallGenerator(ctx context.Context, tc *structs.TestCase, configDir string) ([]byte, error)

CallGenerator 调用Generator

func Contains

func Contains(array interface{}, obj interface{}) bool

Contains 判断数组、切片或Map是否存在某个值

func GetCompiledBinaryFileAbsPath

func GetCompiledBinaryFileAbsPath(typeName, moduleName, configDir string) (string, error)

GetCompiledBinaryFileAbsPath 根据配置文件将对应预编译文件转换成绝对路径

func GetCompiledBinaryFileName

func GetCompiledBinaryFileName(typeName, moduleName string) string

GetCompiledBinaryFileName 获取testlib的二进制程序前缀名

func GetSessionDir

func GetSessionDir(workDir string, SessionID string) (string, error)

GetSessionDir get or create a session directory

func IsExecutableFile

func IsExecutableFile(filePath string) (bool, error)

IsExecutableFile 判断是否是可执行程序(支持linux和macos)

func IsProblemPackage

func IsProblemPackage(filePath string) (bool, error)

IsProblemPackage 判断是否是题目包

func IsZipFile

func IsZipFile(filePath string) (bool, error)

IsZipFile 判断是否是Zip文件

func JSONBytesObject

func JSONBytesObject(jsonBytes []byte, obj interface{}) bool

JSONBytesObject 解析JSON字节数组

func JSONStringObject

func JSONStringObject(jsonStr string, obj interface{}) bool

JSONStringObject 解析JSON字符串

func ObjectToJSONByte

func ObjectToJSONByte(obj interface{}) []byte

ObjectToJSONByte 将对象转换成JSON字节数组

func ObjectToJSONString

func ObjectToJSONString(obj interface{}) string

ObjectToJSONString 将对象转换成JSON字符串

func ObjectToJSONStringFormatted

func ObjectToJSONStringFormatted(conf interface{}) string

ObjectToJSONStringFormatted 将对象转换成JSON字符串并格式化

func ParseGeneratorScript

func ParseGeneratorScript(script string) (string, []string, error)

ParseGeneratorScript 解析generator脚本

func RunUnixShell

func RunUnixShell(options *structs.ShellOptions) (*structs.ShellResult, error)

RunUnixShell 运行UnixShell,支持context

func XMLBytesObject

func XMLBytesObject(xmlStr []byte, obj interface{}) bool

XMLBytesObject 解析XML字节数组

func XMLStringObject

func XMLStringObject(xmlStr string, obj interface{}) bool

XMLStringObject 解析XML字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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