MCPcopy Create free account
hub / github.com/aptly-dev/aptly / Check

Method Check

context/context_test.go:24–65  ·  view source on GitHub ↗
(params []interface{}, names []string)

Source from the content-addressed store, hash-verified

22}
23
24func (checker *fatalErrorPanicChecker) Check(params []interface{}, names []string) (result bool, errmsg string) {
25 f := reflect.ValueOf(params[0])
26 if f.Kind() != reflect.Func || f.Type().NumIn() != 0 {
27 return false, "Function must take zero arguments"
28 }
29 defer func() {
30 if errmsg != "" {
31 return
32 }
33
34 obtained := recover()
35
36 names[0] = "panic"
37
38 var ok bool
39
40 var e1 *FatalError
41 if e1, ok = obtained.(*FatalError); ok {
42 params[0] = e1
43 } else {
44 errmsg = "Panic value is not FatalError"
45 return
46 }
47
48 var e2 *FatalError
49 if e2, ok = params[1].(*FatalError); ok {
50 params[1] = e2
51 } else {
52 errmsg = "Expected value is not FatalError"
53 return
54 }
55
56 if *e1 == *e2 {
57 result = true
58 } else {
59 result = false
60 errmsg = "Not equal"
61 }
62 }()
63 f.Call(nil)
64 return false, "Function has not panicked"
65}
66
67type AptlyContextSuite struct {
68 context *AptlyContext

Calls

no outgoing calls

Tested by

no test coverage detected