MCPcopy Index your code
hub / github.com/gavv/httpexpect / String

Method String

value.go:296–318  ·  view source on GitHub ↗

String returns a new String attached to underlying value. If underlying value is not a string, failure is reported and empty (but non-nil) value is returned. Example: value := NewValue(t, "foo") value.String().IsEqualFold("FOO")

()

Source from the content-addressed store, hash-verified

294// value := NewValue(t, "foo")
295// value.String().IsEqualFold("FOO")
296func (v *Value) String() *String {
297 opChain := v.chain.enter("String()")
298 defer opChain.leave()
299
300 if opChain.failed() {
301 return newString(opChain, "")
302 }
303
304 data, ok := v.value.(string)
305
306 if !ok {
307 opChain.fail(AssertionFailure{
308 Type: AssertValid,
309 Actual: &AssertionValue{v.value},
310 Errors: []error{
311 errors.New("expected: value is string"),
312 },
313 })
314 return newString(opChain, "")
315 }
316
317 return newString(opChain, data)
318}
319
320// Number returns a new Number attached to underlying value.
321//

Callers 15

TestValue_GetStringFunction · 0.95
RequestMethod · 0.45
WebsocketWriteMethod · 0.45
WebsocketReadMethod · 0.45
std2fastFunction · 0.45
ServeHTTPMethod · 0.45
TestFastBinder_BasicFunction · 0.45
TestArray_FailedChainFunction · 0.45
TestArray_EveryFunction · 0.45
TestArray_FilterFunction · 0.45
TestArray_FindFunction · 0.45

Calls 5

newStringFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 15

TestValue_GetStringFunction · 0.76
ServeHTTPMethod · 0.36
TestFastBinder_BasicFunction · 0.36
TestArray_FailedChainFunction · 0.36
TestArray_EveryFunction · 0.36
TestArray_FilterFunction · 0.36
TestArray_FindFunction · 0.36
TestArray_FindAllFunction · 0.36
TestArray_NotFindFunction · 0.36
TestArray_IsOrderedFunction · 0.36
TestExpect_TraverseFunction · 0.36