Add tests for apply_diff errors