MCPcopy Create free account
hub / github.com/gavv/httpexpect / newChainWithDefaults

Function newChainWithDefaults

chain.go:142–173  ·  view source on GitHub ↗

Construct chain using DefaultAssertionHandler and provided Reporter.

(name string, reporter Reporter, flag ...chainFlags)

Source from the content-addressed store, hash-verified

140
141// Construct chain using DefaultAssertionHandler and provided Reporter.
142func newChainWithDefaults(name string, reporter Reporter, flag ...chainFlags) *chain {
143 if reporter == nil {
144 panic("Reporter is nil")
145 }
146
147 c := &chain{
148 context: AssertionContext{},
149 handler: &DefaultAssertionHandler{
150 Formatter: &DefaultFormatter{},
151 Reporter: reporter,
152 },
153 severity: SeverityError,
154 }
155
156 if name != "" {
157 c.context.Path = []string{name}
158 c.context.AliasedPath = []string{name}
159 } else {
160 c.context.Path = []string{}
161 c.context.AliasedPath = []string{}
162 }
163
164 c.context.Environment = newEnvironment(c)
165
166 c.context.TestingTB = isTestingTB(c.handler)
167
168 for _, f := range flag {
169 c.flags |= f
170 }
171
172 return c
173}
174
175// Get environment instance.
176// Root chain constructor either gets environment from config or creates a new one.

Callers 15

TestChain_PanicsFunction · 0.85
TestChain_EnvFunction · 0.85
TestChain_RootFunction · 0.85
TestChain_PathFunction · 0.85
TestChain_AliasedPathFunction · 0.85
TestChain_TestingTBFunction · 0.85
NewEnvironmentFunction · 0.85
NewValueFunction · 0.85
newMockChainFunction · 0.85
NewNumberFunction · 0.85
NewMatchFunction · 0.85
NewArrayFunction · 0.85

Calls 2

newEnvironmentFunction · 0.85
isTestingTBFunction · 0.85

Tested by 15

TestChain_PanicsFunction · 0.68
TestChain_EnvFunction · 0.68
TestChain_RootFunction · 0.68
TestChain_PathFunction · 0.68
TestChain_AliasedPathFunction · 0.68
TestChain_TestingTBFunction · 0.68
newMockChainFunction · 0.68
TestWebsocket_ExpectFunction · 0.68
TestWebsocket_CloseFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…