MCPcopy Index your code
hub / github.com/buger/jsonparser / setTestCheckFoundAndNoError

Function setTestCheckFoundAndNoError

parser_test.go:1247–1269  ·  view source on GitHub ↗

Test helper for SYS-REQ-009.

(t *testing.T, testKind string, test SetTest, value interface{}, err error)

Source from the content-addressed store, hash-verified

1245
1246// Test helper for SYS-REQ-009.
1247func setTestCheckFoundAndNoError(t *testing.T, testKind string, test SetTest, value interface{}, err error) bool {
1248 isFound := (err != KeyPathNotFoundError)
1249 isErr := (err != nil && err != KeyPathNotFoundError)
1250
1251 if test.isErr != isErr {
1252 // If the call didn't match the error expectation, fail
1253 t.Errorf("%s test '%s' isErr mismatch: expected %t, obtained %t (err %v). Value: %v", testKind, test.desc, test.isErr, isErr, err, value)
1254 return false
1255 } else if isErr {
1256 // Else, if there was an error, don't fail and don't check isFound or the value
1257 return false
1258 } else if test.isFound != isFound {
1259 // Else, if the call didn't match the is-found expectation, fail
1260 t.Errorf("%s test '%s' isFound mismatch: expected %t, obtained %t", testKind, test.desc, test.isFound, isFound)
1261 return false
1262 } else if !isFound {
1263 // Else, if no value was found, don't fail and don't check the value
1264 return false
1265 } else {
1266 // Else, there was no error and a value was found, so check the value
1267 return true
1268 }
1269}
1270
1271// Test helper for SYS-REQ-009.
1272func runSetTests(t *testing.T, testKind string, tests []SetTest, runner func(SetTest) (interface{}, ValueType, error), resultChecker func(SetTest, interface{}) (bool, interface{})) {

Callers 1

runSetTestsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…