test

package
v0.0.0-...-e081c89 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayWriterTest

func ArrayWriterTest(t *testing.T, dataType string, input []string, expected string)

ArrayWriterTest is an easy template for testing stdio.ArrayWriter methods in murex types

func ExistsFs

func ExistsFs(t *testing.T, name string, res embed.FS)

func InstalledDepsTest

func InstalledDepsTest(t *testing.T, exec string) bool

InstalledDepsTest checks any external dependencies are installed

func ReadArrayTest

func ReadArrayTest(t *testing.T, dataType string, input []byte, expected []string)

ReadArrayTest is an easy template for testing stdio.ReadArray methods in murex types

func ReadMapOrderedTest

func ReadMapOrderedTest(t *testing.T, dataType string, input []byte, expected []ReadMapExpected, config *config.Config)

ReadMapOrderedTest is an easy template for testing stdio.ReadMap methods in murex types with ordered maps

func ReadMapUnorderedTest

func ReadMapUnorderedTest(t *testing.T, dataType string, input []byte, expected []ReadMapExpected, config *config.Config)

ReadMapUnorderedTest is an easy template for testing stdio.ReadMap methods in murex types with unordered maps

func RunBooleanTests

func RunBooleanTests(tests []BooleanTest, t *testing.T)

RunBooleanTests runs through all the test cases for BooleanTest. Please note this shouldn't be confused with the murex scripting language's inbuilt testing framework!

func RunMethodRegexTest

func RunMethodRegexTest(t *testing.T, cmd func(*lang.Process) error, methodName string, input string, dataType string, params []string, outputMatchRx string)

RunMethodRegexTest is a template function for using regex to test builtins run as methods. dataType should be preloaded in calling functions, eg

    _ "github.com/lmorg/murex/builtins/types/generic"
	   _ "github.com/lmorg/murex/builtins/types/json"

func RunMethodTest

func RunMethodTest(t *testing.T, cmd func(*lang.Process) error, methodName string, input string, dataType string, params []string, output string, expectedError error)

RunMethodTest is a template function for testing builtins run as methods. dataType should be preloaded in calling functions, eg

    _ "github.com/lmorg/murex/builtins/types/generic"
	   _ "github.com/lmorg/murex/builtins/types/json"

func RunMurexTests

func RunMurexTests(tests []MurexTest, t *testing.T)

RunMurexTests runs through all the test cases for MurexTest where STDOUT/ERR are literal strings

func RunMurexTestsRx

func RunMurexTestsRx(tests []MurexTest, t *testing.T)

RunMurexTestsRx runs through all the test cases for MurexTest where STDOUT/ERR are regexp expressions

Types

type BooleanTest

type BooleanTest struct {
	Block  string
	Result bool
}

BooleanTest is a basic framework for each boolean test of murex code. Please note this shouldn't be confused with the murex scripting language's inbuilt testing framework!

type MurexTest

type MurexTest struct {
	Block   string
	Stdout  string
	Stderr  string
	ExitNum int
}

MurexTest is a basic framework to test murex code. Please note this shouldn't be confused with the murex scripting language's inbuilt testing framework!

type ReadMapExpected

type ReadMapExpected struct {
	Key   string
	Value string
	Last  bool
}

ReadMapExpected is used to list the expected output from stdio.ReadMap for the MapTest() test

func (ReadMapExpected) String

func (m ReadMapExpected) String() string

Directories

Path Synopsis
Package count is used to count the number of test cases run
Package count is used to count the number of test cases run

Jump to

Keyboard shortcuts

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