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

Function runParseTests

parser_test.go:2167–2188  ·  view source on GitHub ↗

Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.

(t *testing.T, testKind string, tests []ParseTest, runner func(ParseTest) (interface{}, error), resultChecker func(ParseTest, interface{}) (bool, interface{}))

Source from the content-addressed store, hash-verified

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{})) {
2168 for _, test := range tests {
2169 value, err := runner(test)
2170
2171 if parseTestCheckNoError(t, testKind, test, value, err) {
2172 if test.out == nil {
2173 t.Errorf("MALFORMED TEST: %v", test)
2174 continue
2175 }
2176
2177 if ok, expected := resultChecker(test, value); !ok {
2178 if expectedBytes, ok := expected.([]byte); ok {
2179 expected = string(expectedBytes)
2180 }
2181 if valueBytes, ok := value.([]byte); ok {
2182 value = string(valueBytes)
2183 }
2184 t.Errorf("%s test '%s' expected to return value %v, but did returned %v instead", testKind, test.in, expected, value)
2185 }
2186 }
2187 }
2188}
2189
2190// Verifies: SYS-REQ-036 [example]
2191// MCDC SYS-REQ-036: raw_boolean_literal_is_valid=F, returns_parseboolean_error=T => TRUE

Callers 3

TestParseBooleanFunction · 0.85
TestParseFloatFunction · 0.85
TestParseStringFunction · 0.85

Calls 1

parseTestCheckNoErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…