MCPcopy Create free account
hub / github.com/buger/jsonparser / parseTestCheckNoError

Function parseTestCheckNoError

parser_test.go:2178–2190  ·  view source on GitHub ↗

parseTestCheckNoError checks the error return from Parse*() against the test case expectations. Returns true the test should proceed to checking the actual data returned from Parse*(), or false if the test is finished. Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.

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

Source from the content-addressed store, hash-verified

2176// Returns true the test should proceed to checking the actual data returned from Parse*(), or false if the test is finished.
2177// Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.
2178func parseTestCheckNoError(t *testing.T, testKind string, test ParseTest, value interface{}, err error) bool {
2179 if isErr := (err != nil); test.isErr != isErr {
2180 // If the call didn't match the error expectation, fail
2181 t.Errorf("%s test '%s' isErr mismatch: expected %t, obtained %t (err %v). Obtained value: %v", testKind, test.in, test.isErr, isErr, err, value)
2182 return false
2183 } else if isErr {
2184 // Else, if there was an error, don't fail and don't check isFound or the value
2185 return false
2186 } else {
2187 // Else, there was no error and a value was found, so check the value
2188 return true
2189 }
2190}
2191
2192// Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.
2193func runParseTests(t *testing.T, testKind string, tests []ParseTest, runner func(ParseTest) (interface{}, error), resultChecker func(ParseTest, interface{}) (bool, interface{})) {

Callers 1

runParseTestsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected