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

Function parseTestCheckNoError

parser_test.go:2152–2164  ·  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

2150// Returns true the test should proceed to checking the actual data returned from Parse*(), or false if the test is finished.
2151// Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.
2152func parseTestCheckNoError(t *testing.T, testKind string, test ParseTest, value interface{}, err error) bool {
2153 if isErr := (err != nil); test.isErr != isErr {
2154 // If the call didn't match the error expectation, fail
2155 t.Errorf("%s test '%s' isErr mismatch: expected %t, obtained %t (err %v). Obtained value: %v", testKind, test.in, test.isErr, isErr, err, value)
2156 return false
2157 } else if isErr {
2158 // Else, if there was an error, don't fail and don't check isFound or the value
2159 return false
2160 } else {
2161 // Else, there was no error and a value was found, so check the value
2162 return true
2163 }
2164}
2165
2166// Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.
2167func 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…