statelessCompare compares two values and returns the result. This function is stateless in that it does not alter the current result, or output to any registered reporters.
(step PathStep)
| 221 | // This function is stateless in that it does not alter the current result, |
| 222 | // or output to any registered reporters. |
| 223 | func (s *state) statelessCompare(step PathStep) diff.Result { |
| 224 | // We do not save and restore curPath and curPtrs because all of the |
| 225 | // compareX methods should properly push and pop from them. |
| 226 | // It is an implementation bug if the contents of the paths differ from |
| 227 | // when calling this function to when returning from it. |
| 228 | |
| 229 | oldResult, oldReporters := s.result, s.reporters |
| 230 | s.result = diff.Result{} // Reset result |
| 231 | s.reporters = nil // Remove reporters to avoid spurious printouts |
| 232 | s.compareAny(step) |
| 233 | res := s.result |
| 234 | s.result, s.reporters = oldResult, oldReporters |
| 235 | return res |
| 236 | } |
| 237 | |
| 238 | func (s *state) compareAny(step PathStep) { |
| 239 | // Update the path stack. |
no test coverage detected