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)
| 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. |
| 2179 | func 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. |
| 2194 | func runParseTests(t *testing.T, testKind string, tests []ParseTest, runner func(ParseTest) (interface{}, error), resultChecker func(ParseTest, interface{}) (bool, interface{})) { |