MCPcopy
hub / github.com/lmorg/murex / testBlock

Function testBlock

lang/test_compare_stdio.go:20–47  ·  view source on GitHub ↗
(test *TestProperties, p *Process, block []rune, stdin []byte, dt string, property string, failed *bool)

Source from the content-addressed store, hash-verified

18)
19
20func testBlock(test *TestProperties, p *Process, block []rune, stdin []byte, dt string, property string, failed *bool) {
21 fork := p.Fork(F_FUNCTION | F_CREATE_STDIN | F_CREATE_STDERR | F_CREATE_STDOUT)
22 fork.IsMethod = true
23 fork.Name.Set("(pipe test " + property + ")")
24 fork.Stdin.SetDataType(dt)
25 _, err := fork.Stdin.Write(stdin)
26 if err != nil {
27 p.Tests.AddResult(test, p, TestError, tMsgWriteErr(property, err))
28 *failed = true
29 return
30 }
31
32 exitNum, err := fork.Execute(block)
33 if err != nil {
34 p.Tests.AddResult(test, p, TestError, tMsgCompileErr(property, err))
35 return
36 }
37
38 if exitNum == 0 {
39 p.Tests.AddResult(test, p, TestInfo, tMsgExitNumZero(property))
40 } else {
41 p.Tests.AddResult(test, p, TestFailed, tMsgExitNumNotZero(property, exitNum))
42 *failed = true
43 }
44
45 testReadAllOut(test, p, fork.Stdout, property, failed)
46 testReadAllErr(test, p, fork.Stderr, property, failed)
47}
48
49func testReadAllOut(test *TestProperties, p *Process, std stdio.Io, property string, failed *bool) {
50 b, err := std.ReadAll()

Callers 1

CompareMethod · 0.85

Calls 12

tMsgWriteErrFunction · 0.85
tMsgCompileErrFunction · 0.85
tMsgExitNumZeroFunction · 0.85
tMsgExitNumNotZeroFunction · 0.85
testReadAllOutFunction · 0.85
testReadAllErrFunction · 0.85
ForkMethod · 0.80
AddResultMethod · 0.80
ExecuteMethod · 0.80
SetMethod · 0.65
SetDataTypeMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected