Test helper for SYS-REQ-009.
(t *testing.T, testKind string, test SetTest, value interface{}, err error)
| 1245 | |
| 1246 | // Test helper for SYS-REQ-009. |
| 1247 | func setTestCheckFoundAndNoError(t *testing.T, testKind string, test SetTest, value interface{}, err error) bool { |
| 1248 | isFound := (err != KeyPathNotFoundError) |
| 1249 | isErr := (err != nil && err != KeyPathNotFoundError) |
| 1250 | |
| 1251 | if test.isErr != isErr { |
| 1252 | // If the call didn't match the error expectation, fail |
| 1253 | t.Errorf("%s test '%s' isErr mismatch: expected %t, obtained %t (err %v). Value: %v", testKind, test.desc, test.isErr, isErr, err, value) |
| 1254 | return false |
| 1255 | } else if isErr { |
| 1256 | // Else, if there was an error, don't fail and don't check isFound or the value |
| 1257 | return false |
| 1258 | } else if test.isFound != isFound { |
| 1259 | // Else, if the call didn't match the is-found expectation, fail |
| 1260 | t.Errorf("%s test '%s' isFound mismatch: expected %t, obtained %t", testKind, test.desc, test.isFound, isFound) |
| 1261 | return false |
| 1262 | } else if !isFound { |
| 1263 | // Else, if no value was found, don't fail and don't check the value |
| 1264 | return false |
| 1265 | } else { |
| 1266 | // Else, there was no error and a value was found, so check the value |
| 1267 | return true |
| 1268 | } |
| 1269 | } |
| 1270 | |
| 1271 | // Test helper for SYS-REQ-009. |
| 1272 | func runSetTests(t *testing.T, testKind string, tests []SetTest, runner func(SetTest) (interface{}, ValueType, error), resultChecker func(SetTest, interface{}) (bool, interface{})) { |
no outgoing calls
no test coverage detected
searching dependent graphs…