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

Function parseTestCheckNoError

parser_test.go:2179–2191  ·  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

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